예제 #1
0
         echo "\n";
     }
     echo "\n]";
     break;
 case "delete":
     $id = (int) str_replace("node_", "", $_REQUEST["id"]);
     $tree->remove($id);
     $db->query("DELETE FROM content WHERE id = " . $id);
     echo "OK";
     break;
 case "create":
 case "move":
     $id = (int) str_replace("node_", "", $_REQUEST["id"]);
     $ref_id = (int) str_replace("node_", "", $_REQUEST["ref_id"]);
     $type = $_REQUEST["move_type"];
     $result = $tree->move($id, $ref_id, $type);
     if ($id == 0) {
         foreach ($languages as $k => $lang) {
             $db->query("INSERT INTO content (id,language,name,data) VALUES(" . $result . "," . $k . ",'New folder','')");
         }
         echo "node_" . $result;
     }
     break;
 case "rename":
     $sql = "UPDATE content SET name = '" . addslashes($_REQUEST["data"]) . "' WHERE id = " . (int) str_replace("node_", "", $_REQUEST["id"]) . " AND language = " . (int) $_REQUEST["lang"];
     $db->query($sql);
     echo $sql;
     break;
 case "loadfile":
     $db->query("SELECT * FROM content WHERE id = " . (int) str_replace("node_", "", $_REQUEST["id"]) . " AND language = " . (int) $_REQUEST["lang"]);
     $db->nextr();