123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- <?php
- define('BILLING_CONFIG', 'config/billing.ini');
- $billing_config = parse_ini_file(BILLING_CONFIG);
- include($billing_config['baseconf'] . '/handlers.php');
- /**
- * Low level billing operations wrapper
- * Class just calls ultra low handlers
- */
- class ApiBilling {
- /**
- * Creates some stargazer user
- *
- * @param string $login
- *
- * @return void
- */
- function createuser($login) {
- $login = trim($login);
- billing_createuser($login);
- }
- /**
- * Adds cash to stargazer user account
- *
- * @param string $login
- * @param float $cash
- *
- * @return void
- */
- function addcash($login, $cash) {
- $login = trim($login);
- $cash = trim($cash);
- billing_addcash($login, $cash);
- }
- /**
- * Sets user account cash to some value
- *
- * @param string $login
- * @param float $cash
- *
- * @return void
- */
- function setcash($login, $cash) {
- $login = trim($login);
- $cash = trim($cash);
- billing_setcash($login, $cash);
- }
- /**
- * Sets credit for some user account
- *
- * @param string $login
- * @param float $credit
- */
- function setcredit($login, $credit) {
- $login = trim($login);
- $credit = trim($credit);
- billing_setcredit($login, $credit);
- }
- /**
- * Sets credit expiration date
- *
- * @param string $login
- * @param string $creditexpire
- *
- * @return void
- */
- function setcreditexpire($login, $creditexpire) {
- $login = trim($login);
- $creditexpire = trim($creditexpire);
- billing_setcreditexpire($login, $creditexpire);
- }
- /**
- * Performs stargazer user reinit
- *
- * @param string $login
- *
- * @return void
- */
- function resetuser($login) {
- $login = trim($login);
- billing_resetuser($login);
- }
- /**
- * Sets AlwaysOnline flag to existing user
- *
- * @param string $login
- * @param int $state
- *
- * @return void
- */
- function setao($login, $state) {
- $login = trim($login);
- $state = trim($state);
- billing_setao($login, $state);
- }
- /**
- * Sets DisabledDetailStat flag to existing user
- *
- * @param string $login
- * @param int $state
- *
- * @return void
- */
- function setdstat($login, $state) {
- $login = trim($login);
- $state = trim($state);
- billing_setdstat($login, $state);
- }
- /**
- * Sets IP for some staragazer user login
- *
- * @param string $login
- * @param string $ip
- *
- * @return void
- */
- function setip($login, $ip) {
- $login = trim($login);
- $ip = trim($ip);
- billing_setip($login, $ip);
- }
- /**
- * Sets password for existing user
- *
- * @param string $login
- * @param string $password
- *
- * @return void
- */
- function setpassword($login, $password) {
- $login = trim($login);
- $password = trim($password);
- billing_setpassword($login, $password);
- }
- /**
- * Changes tariff right now for some user
- *
- * @param string $login
- * @param string $tariff
- *
- * @return void
- */
- function settariff($login, $tariff) {
- $login = trim($login);
- $tariff = trim($tariff);
- billing_settariff($login, $tariff);
- }
- /**
- * Sets TariffChange for next month
- *
- * @param string $login
- * @param string $tariff
- *
- * @return void
- */
- function settariffnm($login, $tariff) {
- $login = trim($login);
- $tariff = trim($tariff);
- billing_settariffnm($login, $tariff);
- }
- /**
- * Sets Down flag to existing user
- *
- * @param string $login
- * @param int $state
- *
- * @return void
- */
- function setdown($login, $state) {
- $login = trim($login);
- $state = trim($state);
- billing_setdown($login, $state);
- }
- /**
- * Sets Passive aka Frozen flag to existing user
- *
- * @param string $login
- * @param int $state
- *
- * @return void
- */
- function setpassive($login, $state) {
- $login = trim($login);
- $state = trim($state);
- billing_setpassive($login, $state);
- }
- /**
- * Deletes existing stargazer user
- *
- * @param string $login
- *
- * @return void
- */
- function deleteuser($login) {
- $login = trim($login);
- billing_deleteuser($login);
- }
- /**
- * Creates new stargazer tariff
- *
- * @param string $tariff
- *
- * @return void
- */
- function createtariff($tariff) {
- $tariff = trim($tariff);
- billing_createtariff($tariff);
- }
- /**
- * Deletes existing stargazer tariff
- *
- * @param string $tariff
- *
- * @return void
- */
- function deletetariff($tariff) {
- $tariff = trim($tariff);
- billing_deletetariff($tariff);
- }
- /**
- * Changes existing stargazer tariff options
- *
- * @param string $tariff
- * @param array $options
- *
- * @return void
- */
- function edittariff($tariff, $options) {
- $tariff = trim($tariff);
- billing_edittariff($tariff, $options);
- }
- }
- ?>
|