Beispiel #1
0
     $tariffoptions['Fee'] = trim($tariffoptions['Fee']);
     if (!empty($newtariffname)) {
         $billing->createtariff($newtariffname);
         $billing->edittariff($newtariffname, $tariffoptions);
         log_register("TARIFF CREATE `" . $newtariffname . "`");
     }
 }
 if (isset($_GET['action'])) {
     if (isset($_GET['tariffname'])) {
         $tariffname = $_GET['tariffname'];
         if ($_GET['action'] == 'delete') {
             if (!zb_TariffProtected($tariffname)) {
                 $billing->deletetariff($tariffname);
                 log_register("TARIFF DELETE `" . $tariffname . "`");
                 zb_LousyTariffDelete($tariffname);
                 zb_TariffDeleteSpeed($tariffname);
                 $dshaper = new DynamicShaper();
                 $dshaper->flushTariff($tariffname);
                 rcms_redirect('?module=tariffs');
             } else {
                 log_register("TARIFF DELETE TRY USED `" . $tariffname . "`");
                 show_error(__('Tariff is used by some users'));
                 show_window('', wf_Link('?module=tariffs', __('Back'), true, 'ubButton'));
             }
         }
         if ($_GET['action'] == 'edit') {
             if (isset($_POST['options']['Fee'])) {
                 $tariffoptions = $_POST['options'];
                 $tariffoptions['Fee'] = trim($tariffoptions['Fee']);
                 $billing->edittariff($tariffname, $tariffoptions);
                 log_register("TARIFF CHANGE `" . $tariffname . "`");
Beispiel #2
0
        $existingspeeds = zb_TariffGetAllSpeeds();
        if (!isset($existingspeeds[$tariff]['speeddown'])) {
            zb_TariffCreateSpeed($tariff, 0, 0);
            $existingspeeds = zb_TariffGetAllSpeeds();
        }
        $fieldnames = array('fieldname1' => __('Down speed Kbit/s'), 'fieldname2' => __('Up speed Kbit/s'));
        $fieldkeys = array('fieldkey1' => 'newspeeddown', 'fieldkey2' => 'newspeedup');
        $olddata[1] = $existingspeeds[$tariff]['speeddown'];
        $olddata[2] = $existingspeeds[$tariff]['speedup'];
        show_window(__('Edit speed') . ' ' . $tariff, web_EditorTwoStringDataForm($fieldnames, $fieldkeys, $olddata));
        show_window('', wf_Link("?module=tariffspeeds", 'Back', true, 'ubButton'));
        // if all ok save speed
        if (isset($_POST['newspeeddown']) and isset($_POST['newspeedup'])) {
            zb_TariffDeleteSpeed($tariff);
            $newSpeedDown = trim($_POST['newspeeddown']);
            $newSpeedUp = trim($_POST['newspeedup']);
            zb_TariffCreateSpeed($tariff, $newSpeedDown, $newSpeedUp);
            rcms_redirect("?module=tariffspeeds");
        }
    } else {
        //deleting speed
        if (wf_CheckGet(array('deletespeed'))) {
            zb_TariffDeleteSpeed($_GET['deletespeed']);
            rcms_redirect("?module=tariffspeeds");
        }
        show_window(__('Tariff speeds'), web_TariffSpeedLister());
        show_window('', wf_Link('?module=tariffs', __('Back'), false, 'ubButton'));
    }
} else {
    show_error(__('You cant control this module'));
}