function __importPHPVar($value, $name, $level, $parent = null) { /* Level ist überschritten */ if ($level == -1) { } elseif ($parent == null) { if ($GLOBALS['XQDB_Storage']->isDoc("php://" . $name)) { return $GLOBALS['XQDB_Storage']->doc("php://" . $name); } else { $docNode = $GLOBALS['XQDB_Storage']->createDoc("php://" . $name); __importPHPVar($value, $name, $level, $docNode[0]); return $docNode; } /* Variable ist ein Array */ } elseif (is_array($value)) { foreach ($value as $key => $child) { $id = $GLOBALS['XQDB_Storage']->registerItem(new Element($key), "php", $name); $GLOBALS['XQDB_Storage']->insertItem($id, $parent); __importPHPVar($child, $name, $level - 1, $id); } /* Variable ist ein skalarer Wert */ } else { $id = $GLOBALS['XQDB_Storage']->registerItem(new Text($value), "php", $name); $GLOBALS['XQDB_Storage']->insertItem($id, $parent); } }
function __session($context) { return __importPHPVar($_SESSION['variables'], "_SESSION/variables", -2); }