コード例 #1
0
ファイル: api.userside.php プロジェクト: nightflyza/Ubilling
 /**
  * Do some user finance data changes
  * 
  * @param array $changeParams
  * 
  * @return array
  */
 protected function changeUserFinance($changeParams)
 {
     $result = array();
     if (isset($changeParams['customerid'])) {
         if (isset($this->allUserData[$changeParams['customerid']])) {
             if (isset($changeParams['value'])) {
                 if (zb_checkMoney($changeParams['value'])) {
                     $paymentNotes = isset($changeParams['comment']) ? $changeParams['comment'] : '';
                     zb_CashAdd($changeParams['customerid'], $changeParams['value'], 'add', 1, $paymentNotes);
                     $result = array('result' => 'ok');
                 } else {
                     $result = array('result' => 'error', 'error' => $this->errorNotices['EX_BAD_MONEY_FORMAT'] . ': ' . $changeParams['value']);
                 }
             } else {
                 $result = array('result' => 'error', 'error' => $this->errorNotices['EX_PARAM_MISSED'] . ': value');
             }
         } else {
             $result = array('result' => 'error', 'error' => $this->errorNotices['EX_USER_NOT_EXISTS'] . ': ' . $changeParams['customerid']);
         }
     } else {
         $result = array('result' => 'error', 'error' => $this->errorNotices['EX_PARAM_MISSED'] . ': customer_id');
     }
     return $result;
 }
コード例 #2
0
 /**
  * 
  * @return void/error notice
  */
 public function catchCreateRequest()
 {
     $result = '';
     if (wf_CheckPost(array('newschedlogin', 'newschedaction', 'newscheddate'))) {
         $date = $_POST['newscheddate'];
         $action = $_POST['newschedaction'];
         $param = $_POST['newschedparam'];
         $note = $_POST['newschednote'];
         $login = $_POST['newschedlogin'];
         if (zb_checkDate($date)) {
             switch ($action) {
                 //this action types requires non empty parameter
                 case 'addcash':
                     if ($param) {
                         if (zb_checkMoney($param)) {
                             $this->createTask($date, $login, $action, $param, $note);
                         } else {
                             $result = __('Wrong format of a sum of money to pay');
                         }
                     } else {
                         $result = __('No all of required fields is filled');
                     }
                     break;
                 case 'corrcash':
                     if ($param) {
                         if (zb_checkMoney($param)) {
                             $this->createTask($date, $login, $action, $param, $note);
                         } else {
                             $result = __('Wrong format of a sum of money to pay');
                         }
                     } else {
                         $result = __('No all of required fields is filled');
                     }
                     break;
                 case 'setcash':
                     if ($param) {
                         if (zb_checkMoney($param)) {
                             $this->createTask($date, $login, $action, $param, $note);
                         } else {
                             $result = __('Wrong format of a sum of money to pay');
                         }
                     } else {
                         $result = __('No all of required fields is filled');
                     }
                     break;
                 case 'credit':
                     if ($param >= 0) {
                         if (zb_checkMoney($param)) {
                             $this->createTask($date, $login, $action, $param, $note);
                         } else {
                             $result = __('Wrong format of a sum of money to pay');
                         }
                     } else {
                         $result = __('No all of required fields is filled');
                     }
                     break;
                 case 'creditexpire':
                     if ($param) {
                         if (zb_checkDate($param)) {
                             $this->createTask($date, $login, $action, $param, $note);
                         } else {
                             $result = __('Wrong date format');
                         }
                     } else {
                         $result = __('No all of required fields is filled');
                     }
                     break;
                 case 'tariffchange':
                     if ($param) {
                         $this->createTask($date, $login, $action, $param, $note);
                     } else {
                         $result = __('No all of required fields is filled');
                     }
                     break;
                 case 'tagadd':
                     if ($param) {
                         $this->createTask($date, $login, $action, $param, $note);
                     } else {
                         $result = __('No all of required fields is filled');
                     }
                     break;
                 case 'tagdel':
                     if ($param) {
                         $this->createTask($date, $login, $action, $param, $note);
                     } else {
                         $result = __('No all of required fields is filled');
                     }
                     break;
                     //for this task types parameter may be empty
                 //for this task types parameter may be empty
                 case 'freeze':
                     $this->createTask($date, $login, $action, $param, $note);
                     break;
                 case 'unfreeze':
                     $this->createTask($date, $login, $action, $param, $note);
                     break;
                 case 'reset':
                     $this->createTask($date, $login, $action, $param, $note);
                     break;
                 case 'setspeed':
                     $this->createTask($date, $login, $action, $param, $note);
                     break;
                 case 'down':
                     $this->createTask($date, $login, $action, $param, $note);
                     break;
                 case 'undown':
                     $this->createTask($date, $login, $action, $param, $note);
                     break;
                 case 'ao':
                     $this->createTask($date, $login, $action, $param, $note);
                     break;
                 case 'unao':
                     $this->createTask($date, $login, $action, $param, $note);
                     break;
             }
         } else {
             $result = __('Wrong date format');
         }
     } else {
         $result = __('Something went wrong');
     }
     return $result;
 }
コード例 #3
0
ファイル: api.megogo.php プロジェクト: carriercomm/Ubilling
 /**
  * Creates new tariff in database
  * 
  * @return void/string on error
  */
 public function tariffCreate()
 {
     $result = '';
     if (wf_CheckPost(array('newtariffname', 'newtarifffee', 'newtariffserviceid'))) {
         $nameF = mysql_real_escape_string($_POST['newtariffname']);
         $feeF = mysql_real_escape_string($_POST['newtarifffee']);
         $serviceidF = mysql_real_escape_string($_POST['newtariffserviceid']);
         $primary = wf_CheckPost(array('newtariffprimary')) ? 1 : 0;
         $freePeriod = wf_CheckPost(array('newtarifffreeperiod')) ? 1 : 0;
         if (zb_checkMoney($feeF)) {
             $query = "INSERT INTO `mg_tariffs` (`id`,`name`,`fee`,`serviceid`,`primary`,`freeperiod`) VALUES ";
             $query .= "(NULL,'" . $nameF . "','" . $feeF . "','" . $serviceidF . "','" . $primary . "','" . $freePeriod . "')";
             nr_query($query);
             $newId = simple_get_lastid('mg_tariffs');
             log_register('MEGOGO TARIFF CREATE [' . $newId . '] `' . $_POST['newtariffname'] . '` FEE `' . $_POST['newtarifffee'] . '`');
         } else {
             $result = $this->messages->getStyledMessage(__('Wrong format of a sum of money to pay'), 'error');
         }
     } else {
         $result = $this->messages->getStyledMessage(__('No all of required fields is filled'), 'error');
     }
     return $result;
 }
コード例 #4
0
ファイル: index.php プロジェクト: carriercomm/Ubilling
if (cfr('CREDIT')) {
    if (isset($_GET['username'])) {
        $login = vf($_GET['username']);
        $alterconf = $ubillingConfig->getAlter();
        $credit_limit = $alterconf['STRICT_CREDIT_LIMIT'];
        // change credit if need
        if (isset($_POST['newcredit'])) {
            $rawCredit = $_POST['newcredit'];
            if (isset($alterconf['NEGATIVE_CREDIT_ALLOWED'])) {
                $credit = $alterconf['NEGATIVE_CREDIT_ALLOWED'] ? $rawCredit : vf($rawCredit);
            } else {
                $credit = vf($rawCredit);
            }
            //checking money format
            if (zb_checkMoney($credit)) {
                //credit limit check
                if ($credit_limit != 'DISABLED') {
                    if ($credit <= $credit_limit) {
                        $billing->setcredit($login, $credit);
                        log_register('CHANGE Credit (' . $login . ') ON ' . $credit);
                    }
                } else {
                    $billing->setcredit($login, $credit);
                    log_register('CHANGE Credit (' . $login . ') ON ' . $credit);
                }
                rcms_redirect("?module=creditedit&username=" . $login);
            } else {
                show_error(__('Wrong format of money sum'));
            }
        }
コード例 #5
0
ファイル: index.php プロジェクト: l1ght13aby/Ubilling
<?php

if (cfr('CASH')) {
    if (isset($_GET['username'])) {
        $alter = $ubillingConfig->getAlter();
        $login = vf($_GET['username']);
        // Change finance state if need:
        if (isset($_POST['newcash'])) {
            // Init
            $cash = $_POST['newcash'];
            $operation = vf($_POST['operation']);
            $cashtype = vf($_POST['cashtype']);
            $note = isset($_POST['newpaymentnote']) ? mysql_real_escape_string($_POST['newpaymentnote']) : '';
            // Empty cash hotfix:
            if ($cash != '') {
                if (zb_checkMoney($cash)) {
                    if (isset($alter['SIGNUP_PAYMENTS']) && !empty($alter['SIGNUP_PAYMENTS'])) {
                        zb_CashAddWithSignup($login, $cash, $operation, $cashtype, $note);
                    } else {
                        zb_CashAdd($login, $cash, $operation, $cashtype, $note);
                    }
                    rcms_redirect("?module=addcash&username=" . $login);
                } else {
                    show_window('', wf_modalOpened(__('Error'), __('Wrong format of a sum of money to pay'), '400', '200'));
                    log_register('BALANCEADDFAIL (' . $login . ') WRONG SUMM `' . $cash . '`');
                }
            } else {
                show_window('', wf_modalOpened(__('Error'), __('You have not completed the required amount of money to deposit into account. We hope next time you will be more attentive.'), '400', '150'));
                log_register('BALANCEADDFAIL (' . $login . ') EMPTY SUMM `' . $cash . '`');
            }
        }