Пример #1
0
<?php

// Include libraries
if (file_exists('../../libs/db_get_common.php') === TRUE) {
    // Script call by Ajax
    require_once '../../libs/config.php';
    require_once '../../libs/db_get_common.php';
    require_once '../../libs/db_set_common.php';
    require_once '../../libs/utilfunc.php';
    require_once '../../libs/utilfunc_sd_card.php';
    require_once '../../libs/debug.php';
}
if (!isset($_GET['value']) || empty($_GET['value'])) {
    insert_configuration(strtoupper($_GET['variable']), "", $main_error);
} else {
    insert_configuration(strtoupper($_GET['variable']), $_GET['value'], $main_error);
}
if (count($main_error) > 0) {
    foreach ($main_error as $error) {
        echo json_encode($error);
    }
} else {
    echo json_encode("");
}
Пример #2
0
    $type = $_GET['type'];
}
if (isset($_GET['nb_plugs']) && !empty($_GET['nb_plugs'])) {
    $nb_plugs = $_GET['nb_plugs'];
}
if (!isset($type) || empty($type) || !isset($nb_plugs) || empty($nb_plugs)) {
    echo json_encode("0");
} else {
    if (strcmp("{$type}", "add") == 0) {
        if ($nb_plugs < $GLOBALS['NB_MAX_PLUG']) {
            insert_configuration("NB_PLUGS", $nb_plugs + 1, $main_error);
        }
    }
    if (strcmp("{$type}", "remove") == 0) {
        if ($nb_plugs > 3) {
            insert_configuration("NB_PLUGS", $nb_plugs - 1, $main_error);
        }
    }
}
/*
  if((empty($main_error))||(!isset($main_error))) {
                //Si tout s'est bien passé:
                // On incrémente le nombre de prises définit:
                $nb_plugs=$nb_plugs+1;
                //On positionne les listes déroulantes à la valeur de la nouvelle prise:
                $selected_plug=$nb_plugs;
                $reset_selected=$nb_plugs;
                $export_selected=$nb_plugs;
                $import_selected=$nb_plugs;
                //Affichage des messages d'ajout: 
                $pop_up_message=$pop_up_message.popup_message(__('PLUG_ADDED'));
Пример #3
0
    } else {
        $cost_price_hc = get_configuration("COST_PRICE_HC", $main_error);
    }
    if (!empty($cost_price_hp) && $cost_price_hp != 0) {
        $cost_price_hp = str_replace(",", ".", "{$cost_price_hp}");
        insert_configuration("COST_PRICE_HP", "{$cost_price_hp}", $main_error);
    } else {
        $cost_price_hp = get_configuration("COST_PRICE_HP", $main_error);
    }
    if (isset($start_hc) && !empty($start_hc)) {
        insert_configuration("START_TIME_HC", "{$start_hc}", $main_error);
    } else {
        $start_hc = get_configuration("START_TIME_HC", $main_error);
    }
    if (isset($stop_hc) && !empty($stop_hc)) {
        insert_configuration("STOP_TIME_HC", "{$stop_hc}", $main_error);
    } else {
        $stop_hc = get_configuration("STOP_TIME_HC", $main_error);
    }
    $cost_price = get_configuration("COST_PRICE", $main_error);
}
//Computing cost value:
if (strcmp($select_plug, "distinct_all") != 0 && strcmp($select_plug, "all") != 0) {
    if (isset($submit_cost) && !empty($submit_cost)) {
        $theorical_power = "0";
        $real_power = "0";
    } else {
        $theorical_power = get_theorical_power($select_plug, $cost_type, $main_error, $check);
        $nb = get_nb_days($startday, $endday) + 1;
        $theorical_power = $theorical_power * $nb;
        $startTime = strtotime("{$startday} 12:00");