| 1 | <?php |
| 2 | |
| 3 | function undelete() { |
| 4 | |
| 5 | global $db,$error; |
| 6 | $undelete_id=$_POST['undelete_id']; |
| 7 | if (nodes::getNodeById($undelete_id)) { |
| 8 | $error="node $undelete_id still exist. cannot undelete"; |
| 9 | return false; |
| 10 | } |
| 11 | |
| 12 | $query = "insert into nodes |
| 13 | (node_id, node_name, node_parent, node_vector, node_external_access, |
| 14 | node_system_access, node_children_count, node_creator, node_created, |
| 15 | lastchild_created, k, node_views, node_descendant_count, lastdescendant_created, template_id) |
| 16 | select |
| 17 | tiamat.node_id, tiamat.node_name, tiamat.node_parent, tiamat.node_vector, |
| 18 | tiamat.node_external_access, tiamat.node_system_access, tiamat.node_children_count, tiamat.node_creator, |
| 19 | tiamat.node_created, tiamat.lastchild_created, tiamat.k, tiamat.node_views, tiamat.node_descendant_count, |
| 20 | tiamat.lastdescendant_created, tiamat.template_id from tiamat where tiamat.node_id = '$undelete_id' order by update_performed desc limit 1"; |
| 21 | |
| 22 | $db->query($query); |
| 23 | return true; |
| 24 | } |
| 25 | ?> |
| 26 | |
| 27 | |
| 28 | |