diff --git a/pacotes/phpxbase/Column.class.php b/pacotes/phpxbase/Column.class.php index 6559c56..8e0f46d 100755 --- a/pacotes/phpxbase/Column.class.php +++ b/pacotes/phpxbase/Column.class.php @@ -2,8 +2,8 @@ /** * ---------------------------------------------------------------- * XBase -* XBaseColumn.class.php -* +* XBaseColumn.class.php +* * Developer : Erwin Kooi * released at : Nov 2005 * last modified by : Erwin Kooi @@ -12,7 +12,7 @@ * You're free to use this code as long as you don't alter it * Copyright (c) 2005 Cyane Dynamic Web Solutions * Info? Mail to info@cyane.nl -* +* * -------------------------------------------------------------- * * This class represents a DBF column @@ -105,4 +105,5 @@ class XBaseColumn { function getColIndex() { return $this->colIndex; } -} \ No newline at end of file +} +?> \ No newline at end of file diff --git a/pacotes/phpxbase/Record.class.php b/pacotes/phpxbase/Record.class.php index 7ebe675..09d3b12 100755 --- a/pacotes/phpxbase/Record.class.php +++ b/pacotes/phpxbase/Record.class.php @@ -2,8 +2,8 @@ /** * ---------------------------------------------------------------- * XBase -* Record.class.php -* +* Record.class.php +* * Developer : Erwin Kooi * released at : Nov 2005 * last modified by : Erwin Kooi @@ -12,7 +12,7 @@ * You're free to use this code as long as you don't alter it * Copyright (c) 2005 Cyane Dynamic Web Solutions * Info? Mail to info@cyane.nl -* +* * -------------------------------------------------------------- * * This class defines the data access functions to a DBF record @@ -28,7 +28,7 @@ define ("DBFFIELD_TYPE_DATE","D"); // Date define ("DBFFIELD_TYPE_LOGICAL","L"); // Logical - ? Y y N n T t F f (? when not initialized). define ("DBFFIELD_TYPE_DATETIME","T"); // DateTime -define ("DBFFIELD_TYPE_INDEX","I"); // Index +define ("DBFFIELD_TYPE_INDEX","I"); // Index define ("DBFFIELD_IGNORE_0","0"); // ignore this field @@ -40,7 +40,7 @@ class XBaseRecord { var $deleted; var $inserted; var $recordIndex; - + function XBaseRecord($table, $recordIndex, $rawData=false) { $this->table =& $table; $this->recordIndex=$recordIndex; @@ -118,7 +118,7 @@ class XBaseRecord { case DBFFIELD_TYPE_LOGICAL : return $this->getBoolean($columnObj); case DBFFIELD_TYPE_MEMO : return $this->getMemo($columnObj); case DBFFIELD_TYPE_NUMERIC : return $this->getInt($columnObj); - case DBFFIELD_TYPE_INDEX : return $this->getIndex($columnObj); + case DBFFIELD_TYPE_INDEX : return $this->getIndex($columnObj); case DBFFIELD_IGNORE_0 : return false; } trigger_error ("cannot handle datatype".$columnObj->getType(), E_USER_ERROR); @@ -178,13 +178,13 @@ class XBaseRecord { if ($columnObj->getType()!=DBFFIELD_TYPE_INDEX) trigger_error ($columnObj->getName()." is not an Index column", E_USER_ERROR); $s = $this->choppedData[$columnObj->getColIndex()]; if (!$s) return false; - + $ret = ord($s[0]); for ($i = 1; $i < $columnObj->length; $i++) { $ret += $i * 256 * ord($s[$i]); } - return $ret; - } + return $ret; + } /** * ------------------------------------------------------------------------- @@ -265,7 +265,7 @@ class XBaseRecord { case '0': $this->forceSetString($columnObj,$value); return; - + case true: $this->forceSetString($columnObj,"T"); return; @@ -294,7 +294,7 @@ class XBaseRecord { } $value = str_replace(",",".",$value); //$this->forceSetString($columnObj,intval($value)); - + /** * suggestion from Sergiu Neamt: treat number values as decimals **/ @@ -309,4 +309,5 @@ class XBaseRecord { function serializeRawData() { return ($this->deleted?"*":" ").implode("",$this->choppedData); } -} \ No newline at end of file +} +?> \ No newline at end of file diff --git a/pacotes/phpxbase/Table.class.php b/pacotes/phpxbase/Table.class.php index 9cce977..adb2e5e 100755 --- a/pacotes/phpxbase/Table.class.php +++ b/pacotes/phpxbase/Table.class.php @@ -2,8 +2,8 @@ /** * ---------------------------------------------------------------- * XBase -* Table.class.php -* +* Table.class.php +* * Developer : Erwin Kooi * released at : Nov 2005 * last modified by : Erwin Kooi @@ -12,7 +12,7 @@ * You're free to use this code as long as you don't alter it * Copyright (c) 2005 Cyane Dynamic Web Solutions * Info? Mail to info@cyane.nl -* +* * -------------------------------------------------------------- * * This class provides the main entry to a DBF table file. @@ -59,9 +59,9 @@ class XBaseTable { function XBaseTable($name) { $this->name=$name; } - + function open() { - + $fn = $this->name; $this->isStream=strpos($this->name,"://")!==false; if (!$this->isStream) { @@ -74,9 +74,9 @@ class XBaseTable { $this->fp = fopen($fn,"rb"); $this->readHeader(); return $this->fp!=false; - + } - + function readHeader() { $this->version = $this->readChar(); @@ -95,7 +95,7 @@ class XBaseTable { $this->readBytes(2); //reserved $fieldCount = ($this->headerLength - ($this->foxpro?296:33) ) / 32; - + /* some checking */ if (!$this->isStream && $this->headerLength>filesize($this->name)) trigger_error ($this->name." is not DBF", E_USER_ERROR); if (!$this->isStream && $this->headerLength+($this->recordCount*$this->recordByteLength)-500>filesize($this->name)) trigger_error ($this->name." is not DBF", E_USER_ERROR); @@ -200,7 +200,7 @@ class XBaseTable { function getDeleteCount() { return $this->deleteCount; } - + function toHTML($withHeader=true,$tableArgs="border='1'",$trArgs="",$tdArgs="",$thArgs="") { $result = "\n"; if ($withHeader) { @@ -262,7 +262,7 @@ class XBaseTable { $result .= "
\n"; return $result; } - + /** * ------------------------------------------------------------------------- * private functions @@ -340,4 +340,5 @@ class XBaseTable { $t = getdate($d); return $this->writeShort($t["year"]) + $this->writeChar($t["mon"]) + $this->writeChar($t["mday"]); } -} \ No newline at end of file +} +?> \ No newline at end of file diff --git a/pacotes/phpxbase/WritableTable.class.php b/pacotes/phpxbase/WritableTable.class.php index 9e3675e..c1ca770 100755 --- a/pacotes/phpxbase/WritableTable.class.php +++ b/pacotes/phpxbase/WritableTable.class.php @@ -2,8 +2,8 @@ /** * ---------------------------------------------------------------- * XBase -* WritableTable.class.php -* +* WritableTable.class.php +* * Developer : Erwin Kooi * released at : Jan 2005 * last modified by : Erwin Kooi @@ -12,7 +12,7 @@ * You're free to use this code as long as you don't alter it * Copyright (c) 2005 Cyane Dynamic Web Solutions * Info? Mail to info@cyane.nl -* +* * -------------------------------------------------------------- * * This class extends the main entry to a DBF table file, with writing abilities @@ -21,7 +21,7 @@ **/ class XBaseWritableTable extends XBaseTable { - + /* static */ function cloneFrom($table) { $result =& new XBaseWritableTable($table->name); @@ -56,7 +56,7 @@ class XBaseWritableTable extends XBaseTable { $columns[$i]=$column; $i++; } - + $result =& new XBaseWritableTable($filename); $result->version=131; $result->modifyDate=time(); @@ -83,7 +83,7 @@ class XBaseWritableTable extends XBaseTable { } return $this->fp!=false; } - + function writeHeader() { $this->headerLength=($this->foxpro?296:33) + ($this->getColumnCount()*32); fseek($this->fp,0); @@ -100,7 +100,7 @@ class XBaseWritableTable extends XBaseTable { $this->writeByte($this->mdxFlag); $this->writeByte($this->languageCode); $this->writeBytes(str_pad("", 2,chr(0))); - + foreach ($this->columns as $column) { $this->writeString(str_pad(substr($column->rawname,0,11), 11,chr(0))); $this->writeByte($column->type); @@ -130,7 +130,7 @@ class XBaseWritableTable extends XBaseTable { $data =& $this->record->serializeRawData(); fwrite($this->fp,$data); if ($this->record->inserted) $this->writeHeader(); - flush($this->fp); + //flush($this->fp); } function deleteRecord() { $this->record->deleted=true; @@ -163,7 +163,7 @@ class XBaseWritableTable extends XBaseTable { * private functions * ------------------------------------------------------------------------- */ - + function writeBytes($buf) { return fwrite($this->fp,$buf); } @@ -197,4 +197,5 @@ class XBaseWritableTable extends XBaseTable { $t = getdate($d); return $this->writeShort($t["year"]) + $this->writeChar($t["mon"]) + $this->writeChar($t["mday"]); } -} \ No newline at end of file +} +?> \ No newline at end of file diff --git a/pacotes/phpxbase/api_conversion.php b/pacotes/phpxbase/api_conversion.php index ff80121..5ac58ef 100755 --- a/pacotes/phpxbase/api_conversion.php +++ b/pacotes/phpxbase/api_conversion.php @@ -144,6 +144,4 @@ function xbase_addInstance(&$i) { $xbase_instances[$result]=&$i; return $result; } - - ?> \ No newline at end of file -- libgit2 0.21.2