} break; } } if (empty($new_key)) { echo "3###" . _("Failure: Format not allowed in file") . " " . $editable_files[0] . " (2)"; $error = true; } else { $branch = '[' . implode("][", $child['parents']) . '][\'' . $new_key . '\']'; $ok = eval("\$tree_lr{$branch}= \$new_rule;"); } if ($ok === false && $error == false) { echo "3###" . _("Failure to update XML File") . " (2)"; $error = true; } else { $output = $xml_obj->array2xml($tree_lr); $output = formatOutput($output, $_level_key_name); $output = utf8_decode($output); if (@file_put_contents($path, $output, LOCK_EX) === false) { $error = true; echo "3###" . _("Failure to update XML File") . " (3)"; } else { $result = test_conf(); if ($result !== true) { $error = true; echo "4###" . $result; } } } if ($error == true) { @unlink($path);
} else { $key = preg_replace("/clone###/", "", $v); $child_node = getChild($child, $key); $nodes[$cont - 1][$child_node['node']] = set_new_lk($child_node['tree'], $child_node['tree']['@attributes'][$_level_key_name], $__level_key . "_" . $cont); } $cont++; } $ok = eval("\$tree{$branch}=\$nodes;"); break; } if ($ok === false) { echo "2###" . _("Failure to update XML File") . " (2)"; $error = true; } else { $xml = new xml($_level_key_name); $output = $xml->array2xml($tree); $output = formatOutput($output, $_level_key_name); $output = utf8_decode($output); if (@file_put_contents($path, $output, LOCK_EX) === false) { echo "2###" . _("Failure to update XML File") . " (3)"; $error = true; } else { $res = getTree($file); if (!is_array($res)) { echo $res; $error = true; } else { $tree = $res; $tree_json = array2json($tree, $path); $_SESSION['_tree_json'] = $tree_json; $_SESSION['_tree'] = $tree;
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this package; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, * MA 02110-1301 USA * * * On Debian GNU/Linux systems, the complete text of the GNU General * Public License can be found in `/usr/share/common-licenses/GPL-2'. * * Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt ****************************************************************************/ require_once 'classes/Session.inc'; require_once 'classes/Xml_parser.inc'; require_once '../utils.php'; require_once '../conf/_conf.php'; //Show a rule $__level_key = POST('key'); $_level_key_name = $_SESSION['_level_key_name']; $tree_lr = $_SESSION["_tree"]; $child = getChild($tree_lr, $__level_key); $rule = array("@attributes" => array($_level_key_name => "1"), "0" => array("rule" => $child['tree'])); if (!empty($child)) { $xml_obj = new xml($_level_key_name); $output = $xml_obj->array2xml($rule); echo "1###" . formatOutput($output, $_level_key_name); } else { echo "error###" . _("Failure: Information not available"); }