function exec($args, $stdin, &$stdout, &$stderr, &$system) { if (!empty($args)) { $path = $args; if ($path{0} != "/") $path = $_SESSION['murrix']['path']."/$path"; $node_id = getNode($path); if ($node_id > 0) { $stderr = ucf(i18n("object already exists")); return true; } $parent = new mObject(getNode($_SESSION['murrix']['path'])); if (!(isAdmin() || $parent->hasRight("create"))) { $stderr = ucf(i18n("not enough rights to create folder")); return true; } $object = new mObject(); $object->setClassName("folder"); $object->loadVars(); $object->name = basename($path); $object->language = $_SESSION['murrix']['language']; $object->rights = $parent->getMeta("initial_rights", "rwcrwc---"); $object->group_id = $parent->getMeta("initial_group", $parent->getGroupId()); if (!$object->save()) { $stderr = "Operation unsuccessfull.\n"; $stderr .= "Error output:\n"; $stderr .= $object->getLastError(); return true; } clearNodeFileCache($parent->getNodeId()); $object->linkWithNode($parent->getNodeId()); $stdout = ucf(i18n("created folder successfully")); } else { $stdout = "Usage: oadd [name]\n"; $stdout .= "Example: oadd newfolder"; } return true; }
function sendMessage($subject, $text, $attachment) { if ($this->id <= 0) return false; $user_id = $_SESSION['murrix']['user']->id; $_SESSION['murrix']['user']->id = $this->id; $home = new mObject($this->home_id); $inbox_id = getNode($home->getPath()."/inbox", "eng"); if ($inbox_id < 0) { $inbox = new mObject(); $inbox->setClassName("folder"); $inbox->loadVars(); $inbox->name = "inbox"; $inbox->language = $_SESSION['murrix']['language']; $inbox_id = $inbox->save(); $inbox->rights = $home->getMeta("initial_rights", $home->getRights()); clearNodeFileCache($home->getNodeId()); $inbox->linkWithNode($home->getNodeId()); } else $inbox = new mObject($inbox_id); $message = new mObject(); $message->setClassName("message"); $message->loadVars(); $message->name = $subject; $message->language = $_SESSION['murrix']['language']; $message->setVarValue("text", $text); $message->setVarValue("attachment", $attachment); $message->setVarValue("sender", $_SESSION['murrix']['user']->name); $message->save(); $message->rights = $inbox->getMeta("initial_rights", $inbox->getRights()); clearNodeFileCache($inbox->getNodeId()); $message->linkWithNode($inbox->getNodeId()); $_SESSION['murrix']['user']->id = $user_id; return true; }
function createGroup($name, $description, $create_home = true) { if (!isAdmin) return ucf(i18n("not enough rights to create new group")); if (empty($name)) return ucf(i18n("a name must be specified")); $group = new mGroup(); $group->setByName($name); if ($group->id > 0) return ucf(i18n("a group with that name already exists")); $group->name = $name; $group->description = $description; $ret = $group->save(); if ($create_home && getNode("/root/home/groups/".$name) <= 0) { $home = new mObject(); $home->setClassName("folder"); $home->loadVars(); $home->name = $name; $home->language = $_SESSION['murrix']['language']; $home->rights = "$name=rc"; $home->setVarValue("description", "This is the home of $name"); if ($home->save()) { $home->setMeta("initial_rights", "$name=rwc"); $home_folder = new mObject(getNode("/root/home/groups")); $home->linkWithNode($home_folder->getNodeId()); } else { $message = "Operation unsuccessfull.<br/>"; $message .= "Error output:<br/>"; $message .= $home->getLastError(); return $message; } $group->home_id = $home->getNodeId(); $group->save(); } return $ret; }
function importLines($lines, $fields, $class_name, $parent) { $count = 0; foreach ($lines as $line) { $line = trim($line); if (empty($line)) continue; $array = explode(";", $line); $newobject = new mObject(); $newobject->setClassName($class_name); $newobject->loadVars(); $newobject->name = trim($array[$fields['name']]); $newobject->language = $_SESSION['murrix']['language']; $newobject->rights = $parent->getMeta("initial_rights", $parent->getRights()); $vars = $newobject->getVars(); foreach ($vars as $var) { if (!isset($fields[$var->name])) continue; $value = $array[$fields[$var->name]]; $newobject->setVarValue($var->name, $value); } if ($newobject->save()) { guessObjectType($newobject); clearNodeFileCache($parent->getNodeId()); $newobject->linkWithNode($parent->getNodeId()); $count++; } else { return mMsg::add("importLines", $object->getLastError(), true); } } return $count; }
function execute(&$system, $args) { if (isset($args['node_id'])) { if (isAnonymous()) { $system->addAlert(ucf(i18n("anonymous user can not vote"))); return; } if (!isset($args['answer'])) { $system->addAlert(ucf(i18n("you must choose an alternative"))); return; } $poll = new mObject($args['node_id']); if ($poll->getNodeId() > 0) { $now = time(); if (strtotime($poll->getVarValue("closedate")) < $now) { $system->addAlert(ucf(i18n("this poll is closed"))); return; } if (strtotime($poll->getVarValue("opendate")) > $now) { $system->addAlert(ucf(i18n("this poll is not open yet"))); return; } $answers = fetch("FETCH node WHERE link:node_top='".$poll->getNodeId()."' AND link:type='sub' AND property:class_name='poll_answer' AND property:name='".$_SESSION['murrix']['user']->id."' NODESORTBY property:version"); if (count($answers) > 0) { $system->addAlert(ucf(i18n("you have already voted in this poll"))); return; } $answer = new mObject(); $answer->setClassName("poll_answer"); $answer->loadVars(); $answer->name = $_SESSION['murrix']['user']->id; $answer->language = $_SESSION['murrix']['language']; $answer->rights = $poll->rights;; $answer->setVarValue("answer", $args['answer']); $answer->save(); clearNodeFileCache($poll->getNodeId()); $answer->linkWithNode($poll->getNodeId()); } } $this->draw($system, $args); }
function execute(&$system, $args) { $parent_id = $this->getNodeId($args); $parent = new mObject($parent_id); $class_name = ""; if (!empty($args['class_name'])) $class_name = $args['class_name']; if (empty($class_name)) $class_name = $parent->getMeta("default_class_name", "folder"); if ($parent->hasRight("create") || $parent->hasRight("comment") && $class_name == "comment") { if (isset($args['action']) && $args['action'] == "save") { if (!empty($class_name)) { $languages = explode(",", $args['languages']); $languages_tosave = array(); foreach ($languages as $language) { if (!empty($args[$language.'_name'])) { if (!(strpos($args[$language.'_name'], "\\") === false) || !(strpos($args[$language.'_name'], "/") === false) || !(strpos($args[$language.'_name'], "+") === false)) { $system->addAlert(ucf(i18n($language))." ".i18n("version").": ".ucf(i18n("you can not use '\\', '/' or '+' in the name"))); return; } $languages_tosave[] = $language; } } if (count($languages_tosave) == 0) { $system->addAlert(ucf(i18n("nothing to save"))); return; } $languages = $languages_tosave; $object = new mObject(); $object->setClassName($class_name); $object->loadVars(); $saved = false; foreach ($languages as $language) { $object->name = trim($args[$language.'_name']); $object->icon = trim($args[$language.'_icon']); $object->language = $language; $object->rights = $parent->getMeta("initial_rights", $parent->getRights()); $vars = $object->getVars(); foreach ($vars as $var) { $key = $language."_v".$var->id; $value = (isset($args[$key]) ? $args[$key] : ""); if (empty($value) && $var->getRequired() && $var->getType() != "boolean") { $system->addAlert(utf8e(ucf(i18n($language))." ".i18n("version").": ".ucf(str_replace("_", " ", i18n($var->getName(true))))." ".i18n("is a required field"))); return; } $object->setVarValue($var->name, $value); } if ($object->save()) { guessObjectType($object); $saved = true; } else { $message = "Operation unsuccessfull.<br/>"; $message .= "Error output:<br/>"; $message .= $object->getLastError(); $system->addAlert($message); return; } } if ($saved) { clearNodeFileCache($parent->getNodeId()); $object->linkWithNode($parent->getNodeId()); $system->addRedirect("exec=show&node_id=".$object->getNodeId()); } return; } } } $args['class_name'] = $class_name; $this->draw($system, $args); }
function parseXML($args) { // Instantiate the serializer $Unserializer = &new XML_Unserializer(); // Serialize the data structure $status = $Unserializer->unserialize($args['data']); // Check whether serialization worked if (PEAR::isError($status)) die($status->getMessage()); // Display the PHP data structure $import_data = $Unserializer->getUnserializedData(); $parent = new mObject($args['node_id']); $logtext = ""; if (isset($import_data['version'])) $logtext .= "Version: ".$import_data['version']."<br/>"; if (isset($import_data['name'])) $logtext .= "Created: ".$import_data['created']."<br/>"; if (isset($import_data['name'])) $logtext .= "Name: ".$import_data['name']."<br/>"; if (isset($import_data['description'])) $logtext .= "Description: ".$import_data['description']."<br/>"; $imported_classes = array(); $imported_nodes = array(); $imported_links = array(); $imported_users = array(); $imported_groups = array(); if (isset($import_data['container']['xmldata'])) $import_data['container'] = array($import_data['container']); foreach ($import_data['container'] as $container) { switch ($container['xmldata']) { case "node": $imported_nodes[] = $container; break; case "class": $imported_classes[] = $container; break; case "link": $imported_links[] = $container; break; case "user": $imported_users[] = $container; break; case "group": $imported_groups[] = $container; break; } } if (count($imported_classes) > 0) $logtext .= "Found ".count($imported_classes)." classes<br/>"; if (count($imported_nodes) > 0) $logtext .= "Found ".count($imported_nodes)." nodes<br/>"; if (count($imported_links) > 0) $logtext .= "Found ".count($imported_links)." links<br/>"; if (count($imported_users) > 0) $logtext .= "Found ".count($imported_users)." users<br/>"; if (count($imported_groups) > 0) $logtext .= "Found ".count($imported_groups)." groups<br/>"; $class_table = new mTable("classes"); $vars_table = new mTable("vars"); $initial_meta_table = new mTable("initial_meta"); foreach ($imported_classes as $class) { $logtext .= "Checking database for existing class ".$class['name']."<br/>"; $existing_class = $class_table->get("`name`='".$class['name']."'"); if (count($existing_class) == 0) { $logtext .= "No existing class named ".$class['name']." found, creating<br/>"; $class_table->insert(array("name"=>$class['name'], "default_icon"=>$class['icon'])); if (count($class['variables']) > 0) { foreach ($class['variables'] as $varname => $properties) $vars_table->insert(array("class_name"=>$class['name'], "name"=>$varname, "priority"=>$properties['priority'], "required"=>$properties['required'], "type"=>$properties['type'], "extra"=>$properties['extra'], "comment"=>$properties['comment'])); } if (count($class['metadata']) > 0) { foreach ($class['metadata'] as $name => $value) $initial_meta_table->insert(array("class_name"=>$class['name'], "name"=>$name, "value"=>$value)); } continue; } else $logtext .= "Class named ".$class['name']." found, checking variables<br/>"; $class_object = new mObject(); $class_object->setClassName($class['name']); $class_object->loadVars(); foreach ($class['variables'] as $varname => $properties) { if ($class_object->checkVarExistance($varname) == 0) { $logtext .= "Could not resolve - $varname, skipping, this data will be ignored!<br/>"; continue; } } } $nodes_to_link = array(); $id_conversion = array(); $added_node_ids = array(); $linked_node_ids = array(); $node_table = new mTable("nodes"); foreach ($imported_nodes as $container) { if (!isset($container['created'])) $container['created'] = date("Y-m-d H:i:s"); if (isset($container['rights'])) $rights = $container['rights']; else $rights = $parent->getRights(); $node_id = $node_table->insert(array("created" => $container['created'], "rights" => $rights)); $node = new mObject(); $node->node_id = $node_id; $id_conversion[$container['id']] = $node_id; $added_node_ids[] = $node_id; if (is_array($container['metadata'])) { foreach ($container['metadata'] as $key => $value) { $node->setMeta($key, $value); $logtext .= "Created metadata name=".$key.", value=".$value.", node_id=".$node_id."<br/>"; } } foreach ($container['objects'] as $object_array) { $object = new mObject(); $object->setClassName($object_array['class_name']); $object->loadVars(); if (!isset($object_array['created'])) $object_array['created'] = date("Y-m-d H:i:s"); $object->node_id = $node_id; if (!empty($object_array['created'])) $object->created = $object_array['created']; else $object->created = date("Y-m-d H:i:s"); if (!empty($object_array['version'])) $object->version = $object_array['version']; else $object->version = 1; $object->class_name = $object_array['class_name']; $object->name = $object_array['name']; $object->icon = $object_array['icon']; $object->language = $object_array['language']; if (isset($object_array['user'])) { $user = new mUser(); $user->setByUsername($object_array['user']); $object->user_id = $user->id; } else $object->user_id = $_SESSION['murrix']['user']->id; if (is_array($object_array['variables'])) { foreach ($object_array['variables'] as $key => $value) { if ($object->checkVarExistance($key) == 0) { $logtext .= "Could not resolve - $key, skipping<br/>"; continue; } if (!is_array($value['value'])) $value['value'] = html_entity_decode($value['value']); if ($value['type'] == "file") { $extension = strtolower(pathinfo($value['value'], PATHINFO_EXTENSION)); $oldfile = $args['filepath']."/".$value['fileid'].".$extension"; if (!file_exists($oldfile)) $logtext .= "Could not find file - $oldfile, skipping<br/>"; else $object->setVarValue($key, $value['value'].":$oldfile"); } else if ($value['type'] == "thumbnail") { if (!empty($value['thumb_id'])) { $oldfile = $args['thumbpath']."/".$value['fileid'].".jpg"; if (!file_exists($oldfile)) $logtext .= "Could not find thumbfile - $oldfile, skipping<br/>"; else $object->setVarValue($key, $value['fileid'].".jpg:$oldfile"); } } else $object->setVarValue($key, $value['value']); } } $object->save(true); guessObjectType($object); $logtext .= "Created object name=".$object->name.", node_id=$node_id, id=".$object->id.",version=".$object->version.",language=".$object->language."<br/>"; } } $link_table = new mTable("links"); foreach ($imported_links as $container) { $link_array = array(); $link_array['node_top'] = $id_conversion[$container['node_top']]; $link_array['node_bottom'] = $id_conversion[$container['node_bottom']]; $link_array['type'] = $container['type']; $link_table->insert($link_array); $logtext .= "Linked node_top=".$link_array['node_top']." to node_bottom=".$link_array['node_bottom'].", type=".$link_array['type']."<br/>"; if ($link_array['type'] == "sub") $linked_node_ids[] = $id_conversion[$container['node_bottom']]; } $added_node_ids = array_unique($added_node_ids); $linked_node_ids = array_unique($linked_node_ids); $node_ids_to_link = array_diff($added_node_ids, $linked_node_ids); foreach ($node_ids_to_link as $node_id) { $link_array = array(); $link_array['node_top'] = $args['node_id']; $link_array['node_bottom'] = $node_id; $link_array['type'] = "sub"; $link_table->insert($link_array); $logtext .= "Linked node_top=".$link_array['node_top']." to node_bottom=".$link_array['node_bottom'].", type=".$link_array['type']."<br/>"; } return mMsg::add("mXml::parseXML", $logtext, false); }
function actionSave(&$system, $args) { $bError = false; if (empty($args['name'])) { $system->addAlert(ucf(i18n("please enter a name"))); $bError = true; } if (!(strpos($args['name'], "\\") === false) || !(strpos($args['name'], "/") === false) || !(strpos($args['name'], "+") === false)) { $system->addAlert(ucf(i18n("you can not use '\\', '/' or '+' in the name"))); $bError = true; } if (!$bError) { $object = new mObject($this->getNodeId($args)); if ($object->getNodeId() > 0) { if ($object->hasRight("write")) { $object->name = trim($args['name']); $object->icon = trim($args['icon']); $newlang = ($object->getLanguage() != trim($args['language'])); $object->language = trim($args['language']); $vars = $object->getVars(); foreach ($vars as $var) { $key = "v".$var->id; $value = (isset($args[$key]) ? $args[$key] : (isset($args[$var->id]) ? $args[$var->id] : "")); if (empty($value) && $var->getRequired() && $var->getType() != "boolean") { $system->addAlert(utf8e(ucf(str_replace("_", " ", i18n($var->getName(true))))." ".i18n("is a required field"))); return; } $object->setVarValue($var->name, $value); } if ($args['newversion'] == "on" || $newlang) $ret = $object->save(); else $ret = $object->saveCurrent(); if ($ret) { $system->addRedirect("exec=show&node_id=".$object->getNodeId()); clearNodeFileCache($object->getNodeId()); $links = $object->getLinks(); foreach ($links as $link) { if ($link['type'] == "sub") clearNodeFileCache($link['remote_id']); } } else { $message = "Operation unsuccessfull.<br/>"; $message .= "Error output:<br/>"; $message .= $object->getLastError(); $system->addAlert($message); } } } } }
} if ($_POST['action'] == "newregion") { $region = new mObject(); $region->setClassName("image_region"); $region->loadVars(); $object->language = $_SESSION['murrix']['language']; $region->name = "ImageRegion"; $region->setVarValue("image_width", $_POST['image_width']); $region->setVarValue("image_height", $_POST['image_height']); $region->setVarValue("text", trim($_POST['Textbox'])); $region->setVarValue("params", $_POST['PMouseX'].",".$_POST['PMouseY'].",".$_POST['UMouseX'].",".$_POST['UMouseY']); if ($region->save()) { clearNodeFileCache($object->getNodeId()); $region->linkWithNode($object->getNodeId()); $remote_node_ids = explode(",", $_POST['remote_node_ids']); foreach ($remote_node_ids as $rnode_id) $region->linkWithNode(trim($rnode_id), "data"); echo "Region created successfully"; } else { $message = "Operation unsuccessfull.<br/>"; $message .= "Error output:<br/>";
$object->setClassName("file"); $object->loadVars(); $name = trim($paths['basename']); // replace '\\' with '/' $name = str_replace("\\", "", $name); $name = str_replace("/", "", $name); $name = str_replace("+", "", $name); $object->name = $name; $object->language = $_SESSION['murrix']['language']; $object->rights = $parent_new->getMeta("initial_rights", $parent_new->getRights()); $object->setVarValue("file", trim($paths['basename']).":".$tempName); if ($object->save()) { guessObjectType($object); $object->linkWithNode($parent_new->getNodeId()); clearNodeFileCache($parent_new->getNodeId()); printToLog("Created file". $object->getPath()."<br/>"); $count++; $size += $file['size']; } else { printToLog("Failed to create file ". $object->getPath()."<br/>"); } } printToLog("<br/>Successfully processed files<br/>");
function execute(&$system, $args) { global $abspath, $wwwpath, $db_prefix; if ($args['action'] == "import" && isAdmin()) { if (empty($args['node_id'])) { $system->addAlert(ucf(i18n("you must specifiy a node"))); return; } if (empty($args['file'])) { $system->addAlert(ucf(i18n("you must upload a file to import"))); return; } list($filename, $full_filename) = explode(":", $args['file']); ob_start(); $xml = new mXml(); echo ucf(i18n("log"))."<br/><hr/>"; $data = ""; $extension = pathinfo($filename, PATHINFO_EXTENSION); if ($extension == "bz2") { echo "Found bz2-compressed file.<br/>"; $bz = bzopen($full_filename, "r"); while (!feof($bz)) $data .= bzread($bz, 4096); bzclose($bz); } else { echo "Found uncompressed file.<br/>"; $bz = fopen($full_filename, "r"); while (!feof($bz)) $data .= fread($bz, 4096); fclose($bz); } $import_data = $xml->parseBackupXML($data); if (isset($import_data['verion'])) echo "Version: ".$import_data['verion']."<br/>"; if (isset($import_data['name'])) echo "Created: ".$import_data['created']."<br/>"; if (isset($import_data['name'])) echo "Name: ".$import_data['name']."<br/>"; if (isset($import_data['description'])) echo "Description: ".$import_data['description']."<br/>"; $this->imported_classes = array(); $this->imported_nodes = array(); $this->imported_links = array(); //PrintPre($import_data['container']); foreach ($import_data['container'] as $container) { $xmldata = $container['xmldata']; unset($container['xmldata']); //PrintPre($container); //echo "<hr/>"; switch ($xmldata) { case "node": $this->imported_nodes[] = $container; break; case "class": $this->imported_classes[] = $container; break; case "link": $this->imported_links[] = $container; break; } } $class_table = new mTable("classes"); $vars_table = new mTable("vars"); foreach ($this->imported_classes as $class) { echo "Checking database for existing class ".$class['name']."<br/>"; $existing_class = $class_table->get("`name`='".$class['name']."'"); if (count($existing_class) == 0) { echo "<span style=\"color:red\">No existing class named ".$class['name']." found</span><br/>"; continue; } else echo "<span style=\"color:green\">Class named ".$class['name']." found, checking variables</span><br/>"; $existing_vars = $vars_table->get("`class_name`='".$class['name']."'"); foreach ($class['vars'] as $varname => $properties) { $found = false; foreach ($existing_vars as $existing_var) { if ($existing_var['name'] == $varname) { $found = true; break; } } if ($found) echo "<span style=\"color:green\">Found matching var named $varname, type ".$properties['type']."</span><br/>"; else echo "<span style=\"color:red\">No matching var named $varname, type ".$properties['type']." found</span><br/>"; } } $nodes_to_link = array(); $id_conversion = array(); $added_node_ids = array(); $linked_node_ids = array(); $node_table = new mTable("nodes"); foreach ($this->imported_nodes as $container) { if (!isset($container['created'])) $container['created'] = date("Y-m-d H:i:s"); $node_id = $node_table->insert(array("created" => $container['created'])); $node = new mObject(); $node->node_id = $node_id; $id_conversion[$container['id']] = $node_id; $added_node_ids[] = $node_id; if (is_array($container['metadata'])) { foreach ($container['metadata']['container'] as $metadata) { $node->setMeta($metadata['name'], $metadata['value']); echo "Created metadata name=".$metadata['name'].", value=".$metadata['value'].", node_id=".$node_id."<br/>"; } } foreach ($container['objects'] as $objcontainer) { if (isset($objcontainer['xmldata']) && $objcontainer['xmldata'] == "object") $objects = array($objcontainer); else $objects = $objcontainer; usort(&$objects, array($this, "SortByVersion")); foreach ($objects as $object_array) { $object = new mObject(); $object->setClassName($object_array['class_name']); $object->loadVars(); if (!isset($object_array['created'])) $object_array['created'] = date("Y-m-d H:i:s"); $object->node_id = $node_id; $object->created = $object_array['created']; $object->version = $object_array['version']; $object->class_name = $object_array['class_name']; $object->name = $object_array['name']; $object->icon = $object_array['icon']; $object->language = $object_array['language']; if (isset($object_array['right'])) $object->rights = $object_array['rights']; else $object->rights = ""; if (isset($object_array['user'])) { $user = new mUser(); $user->setByUsername($object_array['user']); $object->user_id = $user->id; } else $object->user_id = $_SESSION['murrix']['user']->id; if (is_array($object_array['vars'])) { foreach ($object_array['vars'] as $key => $value) { if ($object->checkVarExistance($key) == 0) { echo "<span style=\"color:red\">Could not resolve - $key, skipping<br/></span>"; continue; } if (!is_array($value['value'])) $value['value'] = html_entity_decode($value['value']); if ($value['type'] == "file") { $extension = strtolower(pathinfo($value['value'], PATHINFO_EXTENSION)); $oldfile = $args['filepath']."/".$value['file_id'].".$extension"; if (!file_exists($oldfile)) echo "<span style=\"color:red\">Could not find file - $oldfile, skipping<br/></span>"; else $object->setVarValue($key, $value['value'].":$oldfile"); } else if ($value['type'] == "thumbnail") { if (!empty($value['thumb_id'])) { $oldfile = $args['thumbpath']."/".$value['thumb_id'].".jpg"; if (!file_exists($oldfile)) echo "<span style=\"color:red\">Could not find thumbfile - $oldfile, skipping<br/></span>"; else $object->setVarValue($key, $value['thumb_id'].".jpg:$oldfile"); } } else $object->setVarValue($key, $value['value']); } } $object->save(true); guessObjectType($object); echo "Created object name=".$object->name.", node_id=$node_id, id=".$object->id.",version=".$object->version.",language=".$object->language."<br/>"; } } } $link_table = new mTable("links"); foreach ($this->imported_links as $container) { $link_array = array(); $link_array['node_top'] = $id_conversion[$container['node_top']]; $link_array['node_bottom'] = $id_conversion[$container['node_bottom']]; $link_array['type'] = $container['type']; $link_table->insert($link_array); echo "Linked node_top=".$link_array['node_top']." to node_bottom=".$link_array['node_bottom'].", type=".$link_array['type']."<br/>"; if ($link_array['type'] == "sub") $linked_node_ids[] = $id_conversion[$container['node_bottom']]; } $added_node_ids = array_unique($added_node_ids); $linked_node_ids = array_unique($linked_node_ids); $node_ids_to_link = array_diff($added_node_ids, $linked_node_ids); foreach ($node_ids_to_link as $node_id) { $link_array = array(); $link_array['node_top'] = $args['node_id']; $link_array['node_bottom'] = $node_id; $link_array['type'] = "sub"; $link_table->insert($link_array); echo "Linked node_top=".$link_array['node_top']." to node_bottom=".$link_array['node_bottom'].", type=".$link_array['type']."<br/>"; } //print_r($import_data); $system->setZoneData("zone_import_log", utf8e("<br/>".ob_get_end())); return; } $this->draw($system, $args); }