} else {
         $nodes_keys[$k] = $v;
     }
 }
 $num_at = count($at_keys);
 for ($i = 0; $i < $num_at; $i = $i + 2) {
     if ($clean_post[$at_keys[$i]] != '') {
         $j = $i + 1;
         $nodes['@attributes'][$clean_post[$at_keys[$i]]] = $clean_post[$at_keys[$j]];
         unset($clean_post[$at_keys[$i]]);
     }
 }
 $cont = 1;
 foreach ($nodes_keys as $k => $v) {
     $key = !preg_match("/^clone/", $v) ? $v : preg_replace("/clone###/", '', $v);
     $child_node = Ossec::get_child($child, $lk_name, $key);
     $lk_value = $child_node['tree']['@attributes'][$lk_name];
     $new_lk = Ossec::set_new_lk($child_node['tree'], $lk_name, $lk_value, $lk_value . '_' . $cont);
     $nodes[$cont - 1][$child_node['node']] = $new_lk;
     $cont++;
 }
 // Security: code injection
 if (preg_match("/\\;/", $branch)) {
     $data['status'] = 'error';
     $data['data'] = _('Invalid branch value');
     echo json_encode($data);
 } else {
     if (!empty($nodes) && is_array($nodes)) {
         $ok = @eval("\$tree{$branch}=\$nodes;");
     }
 }
Exemple #2
0
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
require_once dirname(__FILE__) . '/../../conf/config.inc';
Session::logcheck('environment-menu', 'EventsHidsConfig');
$lk_name = $_SESSION['lk_name'];
$file = $_SESSION['_current_file'];
$editable = Ossec::is_editable($file);
$node = explode('</span>', strip_tags($_POST['node'], '<span>'));
$node_name = preg_replace('/<span>/', '', $node[0]);
$_SESSION['_current_node'] = $node_name;
$lk_value = strip_tags($_POST['lk_value']);
$_SESSION['_current_level_key'] = $lk_value;
$tree = $_SESSION['_tree'];
$child = Ossec::get_child($tree, $lk_name, $lk_value);
$_SESSION['_current_branch'] = $child;
$parents = $child['parents'];
$ac_data = Ossec::get_ac_type($parents);
echo implode('##__##', $ac_data) . '##__##';
$node_type = Ossec::get_node_type($node_name, $child);
$_SESSION["_current_node_type"] = $node_type;
$sf_data = array('handler' => 'modify', 'lk_value' => $lk_value);
/*
 * Types:
 *   [1]  Attribute
 *   [2]  Attributes
 *   [3]  Text Node
 *   [4]  Node with level <=2
 *   [5]  Node with level > 2
 */