Ejemplo n.º 1
0
/**
 * Freezes user by its login
 * 
 * @param string $login
 * 
 * @return void
 */
function billing_freeze($login)
{
    executor('-u' . $login . ' -i 1');
}
Ejemplo n.º 2
0
 /**
  * @coroutine
  *
  * Uses the global executor to execute a DNS query.
  *
  * @see \Icicle\Dns\Executor\ExecutorInterface::execute()
  *
  * @param string $name
  * @param string|int $type
  * @param array $options
  *
  * @return \Generator
  *
  * @resolve \LibDNS\Messages\Message Response message.
  */
 function execute(string $name, $type, array $options = []) : \Generator
 {
     return executor()->execute($name, $type, $options);
 }
Ejemplo n.º 3
0
function billing_edittariff($tariff, $options)
{
    $dhour = $options['dhour'];
    $dmin = $options['dmin'];
    $nhour = $options['nhour'];
    $nmin = $options['nmin'];
    $PriceDay = $options['PriceDay'];
    $PriceNight = $options['PriceNight'];
    $Fee = (double) $options['Fee'];
    $Free = (double) $options['Free'];
    $PassiveCost = (double) $options['PassiveCost'];
    $Threshold = $options['Threshold'];
    $SinglePrice = $options['SinglePrice'];
    $NoDiscount = $options['NoDiscount'];
    switch ($options['TraffType']) {
        case 'up':
            $TraffType = 0;
            break;
        case 'down':
            $TraffType = 1;
            break;
        case 'up+down':
            $TraffType = 2;
            break;
        case 'max':
            $TraffType = 3;
            break;
        default:
            $TraffType = 2;
            break;
    }
    for ($i = 0; $i < 10; ++$i) {
        $arr = @explode('/', $PriceDay[$i]);
        if ($arr[0] && $arr[1]) {
            $PriceDayAa = $arr[0];
            $PriceDayBb = $arr[1];
        } else {
            $PriceDayAa = @$PriceDay[$i];
            $PriceDayBb = @$PriceDay[$i];
        }
        $PriceDayAc[$i] = $PriceDayAa;
        $PriceDayBc[$i] = $PriceDayBb;
        $arr1 = @explode('/', $PriceNight[$i]);
        if ($arr1[0] && $arr1[1]) {
            $PriceNightAa = $arr1[0];
            $PriceNightBb = $arr1[1];
        } else {
            $PriceNightAa = @$PriceNight[$i];
            $PriceNightBb = @$PriceNight[$i];
        }
        $PriceNightAc[$i] = $PriceNightAa;
        $PriceNightBc[$i] = $PriceNightBb;
        $array[$i] = @array('hday' => (int) $dhour[$i], 'mday' => (int) $dmin[$i], 'hnight' => (int) $nhour[$i], 'mnight' => (int) $nmin[$i], 'pricedaya' => (double) $PriceDayAc[$i], 'pricedayb' => (double) $PriceDayBc[$i], 'pricenighta' => (double) $PriceNightAc[$i], 'pricenightb' => (double) $PriceNightBc[$i], 'threshold' => (int) $Threshold[$i], 'singleprice' => (bool) $SinglePrice[$i], 'nodiscount' => (bool) $NoDiscount[$i]);
    }
    executor('chg_tariff', array($tariff, array('fee' => $Fee, 'freemb' => $Free, 'passivecost' => $PassiveCost, 'traffType' => $TraffType, 'dirprices' => $array)));
}
Ejemplo n.º 4
0
function billing_setpassive($login, $state)
{
    executor('-u' . $login . ' -i ' . $state);
}
Ejemplo n.º 5
0
function billing_edittariff($tariff, $options)
{
    $dhour = $options['dhour'];
    $dmin = $options['dmin'];
    $nhour = $options['nhour'];
    $nmin = $options['nmin'];
    $PriceDay = $options['PriceDay'];
    $PriceNight = $options['PriceNight'];
    $Fee = $options['Fee'];
    $Free = $options['Free'];
    $PassiveCost = $options['PassiveCost'];
    $TraffType = $options['TraffType'];
    if (isset($options['Period'])) {
        $period = $options['Period'];
    } else {
        $period = '';
    }
    $dirs = getAllDirs();
    $string = "<SetTariff name=\"{$tariff}\">";
    $string .= "<Fee value=\"{$Fee}\"/>";
    $string .= "<Free value=\"{$Free}\"/>";
    $string .= "<PassiveCost value=\"{$PassiveCost}\"/>";
    $string .= "<TraffType value=\"{$TraffType}\"/>";
    if (!empty($period)) {
        $string .= "<period value=\"" . $period . "\"/>";
    }
    foreach ($dirs as $dir) {
        $key = $dir['rulenumber'];
        $string .= "<Time{$key} value=\"{$dhour[$key]}:{$dmin[$key]}-{$nhour[$key]}:{$nmin[$key]}\"/>";
    }
    foreach ($options['PriceDay'] as $key => $value) {
        $arr = explode('/', $value);
        if ($arr[0] && $arr[1]) {
            $PriceDayAa = $arr[0];
            $PriceDayBb = $arr[1];
        } else {
            $PriceDayAa = $value;
            $PriceDayBb = $value;
        }
        $PriceDayAc[$key] = $PriceDayAa;
        $PriceDayBc[$key] = $PriceDayBb;
    }
    if (isset($options['PriceNight'])) {
        foreach ($options['PriceNight'] as $key => $value) {
            $arr = explode('/', $value);
            if ($arr[0] && $arr[1]) {
                $PriceNightAa = $arr[0];
                $PriceNightBb = $arr[1];
            } else {
                $PriceNightAa = $value;
                $PriceNightBb = $value;
            }
            $PriceNightAc[$key] = $PriceNightAa;
            $PriceNightBc[$key] = $PriceNightBb;
        }
    }
    for ($i = 0; $i <= 9; $i++) {
        if ($PriceDayAc[$i]) {
            if (isset($PriceDayA)) {
                $sep = '/';
            }
            $PriceDayA .= $sep . $PriceDayAc[$i];
        } else {
            if (isset($PriceDayA)) {
                $sep = '/';
            }
            $PriceDayA .= $sep . '0';
        }
        if ($PriceDayBc[$i]) {
            if (isset($PriceDayB)) {
                $sep1 = '/';
            }
            $PriceDayB .= $sep1 . $PriceDayBc[$i];
        } else {
            if (isset($PriceDayB)) {
                $sep1 = '/';
            }
            $PriceDayB .= $sep1 . '0';
        }
        if ($PriceNightAc[$i]) {
            if (isset($PriceNightA)) {
                $sep2 = '/';
            }
            $PriceNightA .= $sep2 . $PriceNightAc[$i];
        } else {
            if (isset($PriceNightA)) {
                $sep2 = '/';
            }
            $PriceNightA .= $sep . '0';
        }
        if ($PriceNightBc[$i]) {
            if (isset($PriceNightB)) {
                $sep3 = '/';
            }
            $PriceNightB .= $sep3 . $PriceNightBc[$i];
        } else {
            if (isset($PriceNightB)) {
                $sep3 = '/';
            }
            $PriceNightB .= $sep3 . '0';
        }
        ///////////////////////////////////////
        if ($options['Threshold'][$i]) {
            if (isset($Threshold)) {
                $sep4 = '/';
            }
            $Threshold .= $sep4 . $options['Threshold'][$i];
        } else {
            if (isset($Threshold)) {
                $sep4 = '/';
            }
            $Threshold .= $sep4 . '0';
        }
        ////////////////////////////////////////
        if ($options['SinglePrice'][$i]) {
            if (isset($SinglePrice)) {
                $sep5 = '/';
            }
            $SinglePrice .= $sep5 . $options['SinglePrice'][$i];
        } else {
            if (isset($SinglePrice)) {
                $sep5 = '/';
            }
            $SinglePrice .= $sep5 . "0";
        }
        ////////////////////////////////////////
        if ($options['NoDiscount'][$i] != false) {
            if (isset($NoDiscount)) {
                $sep6 = '/';
            }
            $NoDiscount .= $sep6 . $options['NoDiscount'][$i];
        } else {
            if (isset($NoDiscount)) {
                $sep6 = '/';
            }
            $NoDiscount .= $sep6 . '0';
        }
    }
    $string .= "<PriceDayA value=\"{$PriceDayA}\"/>";
    $string .= "<PriceDayB value=\"{$PriceDayB}\"/>";
    $string .= "<PriceNightA value=\"{$PriceNightA}\"/>";
    $string .= "<PriceNightB value=\"{$PriceNightB}\"/>";
    $string .= "<SinglePrice value=\"{$SinglePrice}\"/>";
    $string .= "<NoDiscount value=\"{$NoDiscount}\"/>";
    $string .= "<Threshold value=\"{$Threshold}\"/>";
    $string .= "</SetTariff>";
    executor($string);
}