public static function addNewPMWallet() { $account_id = Core::validate($_POST['ACCOUNT_ID']); $pass_phrase = Core::validate($_POST['PASS_PHRASE']); $alternate_pass_phrase = Core::validate($_POST['ALTERNATE_PASS_PHRASE']); $units = Core::validate($_POST['UNITS']); $account = Core::validate($_POST['ACCOUNT']); $share = Core::validate($_POST['SHARE']); // percent if ($account_id == null || $pass_phrase == null || $alternate_pass_phrase == null || $units == null || $account == null || $share == null || !Core::isDouble($share)) { print 'Incorrect input data'; exit; } $result = WalletsPm::findBy(array('account' => $account)); if (!empty($result)) { print 'This account already exists'; exit; } $perfectMoney = new PerfectMoney(); $perfectMoney->setAccountId($account_id); $perfectMoney->setPassPhrase($pass_phrase); $resp = $perfectMoney->balance(); if ($resp == null) { print $perfectMoney->getError(); exit; } if (!isset($resp[$account])) { print 'Invalid account'; exit; } $value = $resp[$account]; $pmWallet = new WalletsPm(); $pmWallet->setAccountId($account_id); $pmWallet->setPassPhrase($pass_phrase); $pmWallet->setAlternatePassPhrase($alternate_pass_phrase); $pmWallet->setUnits($units); $pmWallet->setAccount($account); $pmWallet->setValue($value); $pmWallet->setShare($share / 100.0); $pmWallet->insert(); header('Location: /admin/pm'); }
private static function PM_MinAndMaxWallets($units) { $pm_wallets = WalletsPm::findBy(array('units' => $units)); if (empty($pm_wallets)) { return null; } $maxBalance = null; $keyMax = null; $minBalance = null; $keyMin = null; $perfectMoney = new PerfectMoney(); foreach ($pm_wallets as $key => $value) { $perfectMoney->setAccountID($value['account_id']); $perfectMoney->setPassPhrase($value['pass_phrase']); $response = $perfectMoney->balance(); if ($response !== null) { $balance = $response[$value['account']]; $pm_wallets[$key]['current_balance'] = $balance; if ($minBalance === null || $minBalance > $balance) { $minBalance = $balance; $keyMin = $key; } if ($maxBalance === null || $maxBalance < $balance) { $maxBalance = $balance; $keyMax = $key; } } } $result['min'] = $pm_wallets[$keyMin]; $result['max'] = $pm_wallets[$keyMax]; return $result; }
<?php $ACCESS_LEVEL = ACCESS_LEVEL_ADMIN; include_once DOC_ROOT . '/includes/authorization.php'; include_once LIB_ROOT . '/users/statistics.class.php'; $stats = new Statistics(); $stats->select = ' sum(amount) as sum '; $deposited = $stats->getLines(array('d'), 2); $reinvested = $stats->getLines(array('i'), 1); $earned = $stats->getLines(array('e'), 1); $withdrawn = $stats->getLines(array('w'), 1); $referral_bonuses = $stats->getLines(array('r'), 1); Project::getInstance()->getSmarty()->assign('deposited', $deposited[0]['sum'] - abs($reinvested[0]['sum'])); Project::getInstance()->getSmarty()->assign('reinvested', $reinvested[0]['sum']); Project::getInstance()->getSmarty()->assign('earned', $earned[0]['sum']); Project::getInstance()->getSmarty()->assign('withdrawn', $withdrawn[0]['sum']); Project::getInstance()->getSmarty()->assign('referral_bonuses', $referral_bonuses[0]['sum']); include_once LIB_ROOT . '/liberty.class.php'; $LR = new LibertyReserve(get_setting('lr_api'), get_setting('lr_api_secword')); Project::getInstance()->getSmarty()->assign('lr_balance', $LR->getBalance(get_setting('lr_account'))); include_once LIB_ROOT . '/perfect.class.php'; $PM = new PerfectMoney(get_setting('pm_member_id'), get_setting('pm_password')); $balance = $PM->getBalance(); Project::getInstance()->getSmarty()->assign('pm_balance', $balance[get_setting('pm_account')]); include_once LIB_ROOT . '/php-ofc-library/open-flash-chart-object.php'; Project::getInstance()->getSmarty()->assign('chart', open_flash_chart_object_str(1000, 500, 'chart-data.php', false, '/admin/')); Project::getInstance()->getSmarty()->display('../default/admin/statistics.tpl');
location($_SERVER['PHP_SELF'], '<p class=imp><strong>Attention:</strong> The next withdrawal request can be made within ' . WITHDRAWAL_DELAY . ' seconds delay.</p>'); } //���� ��� ������� if (Project::getInstance()->getCurUser()->monitor) { $balance = floatval($user['bonus'] + $user['reinvest'] > 0 ? $balance - ($user['bonus'] + $user['reinvest']) : $balance); } //���� ������������� ����� ������, ���� ����� ������� if (floatval($_POST['amount']) > MIN_WITHDRAW && floatval($_POST['amount']) <= $balance) { //������� ��������� ���� if ($user['payment_system'] == 'LR') { include_once LIB_ROOT . '/liberty.class.php'; $gateway = new LibertyReserve(get_setting('lr_api'), get_setting('lr_api_secword')); $account = get_setting('lr_account'); } elseif ($user['payment_system'] == 'PM') { include_once LIB_ROOT . '/perfect.class.php'; $gateway = new PerfectMoney(get_setting('pm_member_id'), get_setting('pm_password')); $account = get_setting('pm_account'); } /** * ��������� ������� �� ���������� */ if (get_setting('transaction_limit') == 0 & $user['withdrawal_limit'] == 0) { $limit = 0; } if (get_setting('transaction_limit') == 0 && $user['withdrawal_limit'] > 0) { $limit = floatval($user['withdrawal_limit']); } elseif (get_setting('transaction_limit') > 0 && $user['withdrawal_limit'] == 0) { $limit = floatval(get_setting('transaction_limit')); } elseif (get_setting('transaction_limit') > $user['withdrawal_limit']) { $limit = floatval($user['withdrawal_limit']); } else {