function add_col($r) { if (!$r['_menus_']) { $r['_menus_'] = msq_menus($r); } foreach ($r as $k => $v) { $v[] = $k == '_menus_' ? 'val' . (count($v) + 1) : ''; $ret[$k] = $v; } return $ret; }
function modif_vars($dr, $nod, $arr, $k, $dfb = '') { $bs = root() . 'msql/'; if (!$dfb && is_array($arr)) { $dfb = msq_menus($arr); } if ($nod) { $r = msql_read_b($dr, $nod, '', '', $dfb); } if ($k == 'mdf') { foreach ($arr as $ka => $va) { if ($ka == 'push') { $r[] = $va; } else { $r[$ka] = $va; } } } elseif ($k == 'add') { foreach ($arr as $ka => $va) { $r[] = $va; } } elseif ($k == 'addon') { foreach ($arr as $ka => $va) { $r[] = array($va); } } elseif ($k == 'addif') { if ($r) { $rk = array_keys_r($r, 0, 'k'); } if ($arr) { foreach ($arr as $ka => $va) { if (!$rk[$va[0]]) { $r[] = $va; } } } } elseif ($k == 'push') { $r[] = $arr; } elseif ($k == 'shift') { array_unshift($r, $arr); } elseif ($k == 'del') { unset($r[$arr]); } elseif ($k == 'repl') { $r = $arr; } elseif ($k) { $r[$k] = $arr; } if ($r[0] && array_sum(array_keys($r)) > 0) { $r = msq_reorder($r); } msql_save($dr, $nod, $r); //db_write(db_f($dr,$nod),$r); return $r; }