Esempio n. 1
0
<?php

if (cfr('SIGNUPPRICES')) {
    global $ubillingConfig;
    $alter = $ubillingConfig->getAlter();
    if (isset($alter['SIGNUP_PAYMENTS']) && !empty($alter['SIGNUP_PAYMENTS'])) {
        if (isset($_GET['tariff'])) {
            $tariff = mysql_real_escape_string($_GET['tariff']);
            $prices = zb_TariffGetAllSignupPrices();
            if (!isset($prices[$tariff])) {
                zb_TariffCreateSignupPrice($tariff, 0);
                $prices = zb_TariffGetAllSignupPrices();
            }
            if (isset($_POST['new_price'])) {
                zb_TariffDeleteSignupPrice($tariff);
                zb_TariffCreateSignupPrice($tariff, $_POST['new_price']);
                rcms_redirect("?module=signupprices");
            }
            $form = '<form action="" method="POST">
                <table width="100%" border="0">
                    <tr>
                        <td class="row2">' . __('Signup price') . '</td>
                        <td class="row3">
                            <input type="text" name="new_price" value="' . $prices[$tariff] . '">
                        </td>
                    </tr>
                </table>
                <input type="submit" value="' . __('Change') . '">
            </form><br><br>';
            show_window(__('Edit signup price for tariff') . ' "' . $tariff . '"', $form);
            show_window('', wf_Link("?module=signupprices", 'Back', true, 'ubButton'));
Esempio n. 2
0
         $billing->settariffnm($login, $tariff);
         log_register('CHANGE TariffNM (' . $login . ') ON `' . $tariff . '`');
     }
     //auto credit option handling
     if ($alter_conf['TARIFFCHGAUTOCREDIT']) {
         $newtariffprice = zb_TariffGetPrice($tariff);
         $billing->setcredit($login, $newtariffprice);
         log_register("CHANGE AutoCredit (" . $login . ") ON `" . $newtariffprice . '`');
     }
     if (isset($alter_conf['SIGNUP_PAYMENTS']) && !empty($alter_conf['SIGNUP_PAYMENTS'])) {
         if (isset($_POST['charge_signup_price'])) {
             $has_paid = zb_UserGetSignupPricePaid($login);
             $old_price = zb_UserGetSignupPrice($login);
             $new_price = zb_TariffGetAllSignupPrices();
             if (!isset($new_price[$tariff])) {
                 zb_TariffCreateSignupPrice($tariff, 0);
                 $new_price = zb_TariffGetAllSignupPrices();
             }
             if ($new_price[$tariff] >= $has_paid) {
                 $cash = $old_price - $new_price[$tariff];
                 zb_UserChangeSignupPrice($login, $new_price[$tariff]);
                 $billing->addcash($login, $cash);
                 log_register("CHARGE SignupPriceFee(" . $login . ") " . $cash . " ACCORDING TO " . $tariff);
             } else {
                 show_window('', wf_modalOpened(__('Error'), __('You may not setup connection payment less then user has already paid!'), '400', '150'));
             }
         }
     }
 }
 $current_tariff = zb_UserGetStargazerData($login);
 $current_tariff = $current_tariff['Tariff'];