示例#1
0
/**
 * Sets credit for user, logs it, sets expire date and redirects in main profile
 * 
 * @param string $user_login
 * @param float  $tariffprice
 * @param int    $sc_price
 * @param string $scend
 * @param int $sc_cashtypeid
 * 
 *  @return void
 */
function zbs_CreditDoTheCredit($user_login, $tariffprice, $sc_price, $scend, $sc_cashtypeid)
{
    zbs_CreditLogPush($user_login);
    billing_setcredit($user_login, $tariffprice + $sc_price);
    billing_setcreditexpire($user_login, $scend);
    zbs_PaymentLog($user_login, '-' . $sc_price, $sc_cashtypeid, "SCFEE");
    billing_addcash($user_login, '-' . $sc_price);
    show_window('', __('Now you have a credit'));
    rcms_redirect("index.php");
}
示例#2
0
 if (isset($_POST['agree'])) {
     // and not enought money, set credit
     if ($user_cash < $change_prices[$_POST['newtariff']]) {
         //if TC_CREDIT option enabled
         if ($tc_credit) {
             $newcredit = $change_prices[$_POST['newtariff']] + $user_credit;
             billing_setcredit($user_login, $newcredit);
             // check for current credit expirity - added in 0.5.7
             // without this check this conflicts with SC_ module
             if (!$user_credit_expire) {
                 //set credit expire date for month from this moment
                 $timestamp = time();
                 $monthOffset = $timestamp + 2678400;
                 // 31 days in seconds
                 $creditend = date("Y-m-d", $monthOffset);
                 billing_setcreditexpire($user_login, $creditend);
             }
         }
     }
     //TC change fee anyway
     zbs_PaymentLog($user_login, '-' . $change_prices[$_POST['newtariff']], $tc_cashtypeid, "TCHANGE:" . $_POST['newtariff']);
     billing_addcash($user_login, '-' . $change_prices[$_POST['newtariff']]);
     //nm set tariff routine
     $nextMonthTc = true;
     if (isset($us_config['TC_RIGHTNOW'])) {
         if ($us_config['TC_RIGHTNOW']) {
             $nextMonthTc = false;
         }
     }
     if ($nextMonthTc) {
         billing_settariffnm($user_login, mysql_real_escape_string($_POST['newtariff']));
示例#3
0
 function setcreditexpire($login, $creditexpire)
 {
     $login = trim($login);
     $creditexpire = trim($creditexpire);
     billing_setcreditexpire($login, $creditexpire);
 }