diff --git a/inc/Class.PHPJSONDB.inc.php b/inc/Class.PHPJSONDB.inc.php index 1dbb98f..c1b37b0 100644 --- a/inc/Class.PHPJSONDB.inc.php +++ b/inc/Class.PHPJSONDB.inc.php @@ -3,6 +3,7 @@ class PHPJSONDB { static function put($db,$table,$item,$data) { global $phpjsondb_dbpath; + if ( !isset($phpjsondb_dbpath) ) { $phpjsondb_dbpath="./db"; } if ( !file_exists($phpjsondb_dbpath."/".$db."/".$table."/".md5($item).".data") ) { @mkdir($phpjsondb_dbpath."/".$db."/".$table,0755,TRUE); file_put_contents($phpjsondb_dbpath."/".$db."/".$table."/".md5($item).".json",json_encode($data)); @@ -10,6 +11,7 @@ class PHPJSONDB { return TRUE; } static function get($db,$table,$item) { + if ( !isset($phpjsondb_dbpath) ) { $phpjsondb_dbpath="./db"; } global $phpjsondb_dbpath; if ( file_exists($phpjsondb_dbpath."/".$db."/".$table."/".md5($item).".json") ) { return json_decode(file_get_contents($phpjsondb_dbpath."/".$db."/".$table."/".md5($item).".json"));