Exemple #1
0
        echo $coma;
        $value = null;
        $value2 = null;
        $value = mb_detect_encoding($filter['value'] . " ", 'UTF-8,ISO-8859-1') == 'UTF-8' ? $filter['value'] : mb_convert_encoding($filter['value'], 'UTF-8', 'ISO-8859-1');
        $value2 = mb_detect_encoding($filter['value2'] . " ", 'UTF-8,ISO-8859-1') == 'UTF-8' ? $filter['value2'] : mb_convert_encoding($filter['value2'], 'UTF-8', 'ISO-8859-1');
        echo "{\"type\":\"" . $filter['type'] . "\",\"subtype\":\"" . $filter['subtype'] . "\",\"match\":\"" . $filter['match'] . "\",\"value\":\"" . $value . "\",\"value2\":\"" . $value2 . "\"}";
        $coma = ",";
    }
    $description = mb_detect_encoding($data['description'] . " ", 'UTF-8,ISO-8859-1') == 'UTF-8' ? $data['description'] : mb_convert_encoding($data['description'], 'UTF-8', 'ISO-8859-1');
    echo "],\"op\":\"" . $data['op'] . "\",\"descr\":\"" . $description . "\"}";
} elseif (GET('inv_do') == "delete") {
    $profile_name = base64_decode(GET('name'));
    $name = mb_detect_encoding($profile_name . " ", 'UTF-8,ISO-8859-1') == 'UTF-8' ? $profile_name : mb_convert_encoding($profile_name, 'UTF-8', 'ISO-8859-1');
    $name = Util::utf8entities($name);
    $name = mb_convert_encoding($name, 'ISO-8859-1', 'UTF-8');
    $config->del($user, $name, "inv_search");
    unset($_SESSION['inventory_search']);
    unset($_SESSION['inventory_last_search']);
    unset($_SESSION['profile']);
} elseif (GET('inv_do') == "getall") {
    $data = $config->get_all($user, "inv_search");
    if (!is_array($data) || empty($data)) {
        exit;
    }
    foreach ($data as $k => $v) {
        $profile = Util::utf8entities(mb_convert_encoding($v, 'UTF-8', 'ISO-8859-1'));
        $profiles[$k] = base64_encode($profile) . "###" . $profile;
    }
    $profiles = implode(",", $profiles);
    echo $profiles;
} elseif (GET('inv_do') == "last_search") {