$j){ if(!is_array($j)){ $_POST[$i] = stripslashes($j); } } } $path = explode("/", $_SESSION['path']); $root = new Root(); $root->load($path); $current =& $root->getCurrent($path); //process action if(isset($_POST['action'])){ switch($_POST['action']){ case "load": $path = explode("/", $_POST['position']); $current->unlock(); $root->load($path); $current =& $root->getCurrent($path); $current->lock(); break; case "save": $current->update(); $current->save(); break; case "insert": $current->update(); $child =& $current->insertChild($_POST['position'], $_POST['type']); $current->save(); $path = $child->getPath(); $_SESSION['path'] = implode("/", $path); session_write_close(); header("Location: index.php"); exit; break; case "delete": $current->update(); $current->deleteChild($_POST['position']); $current->save(); break; case "moveup": $current->update(); $current->moveChild($_POST['position'], "up"); $current->save(); break; case "movedown": $current->update(); $current->moveChild($_POST['position'], "down"); $current->save(); break; case "cut": $current->update(); $current->cutChild($_POST['position']); $current->save(); break; case "paste": $current->update(); $current->pasteChild($_POST['position']); $current->save(); break; case "publish": $current->update(); $current->save(); $current->publish(); break; case "cancel": array_pop($path); $current->unlock(); $root->load($path); $current =& $root->getCurrent($path); $current->lock(); break; default: $current->update(); $current->handleAction($_POST['action'], $_POST['position'], $_POST['type']); break; } } //print output $t = new Template("flexicon.html"); $t->setVar("TREE", $root->printTreeMenu($path)); $t->setVar("BREADCRUMBS", $root->printBreadcrumbs($path)); $t->setVar("TITLE", $current->toString()); $t->setVar("CONTENT", $current->printContent()); $t->setVar("ACTION", "index.php"); $t->parse(); $_SESSION['path'] = implode("/", $path); ?>