/** * Создание нового предложения * * @param array $create Переменная типа array(name=>value) где name - поле таблицы, value - значение для записи (@see Таблица freelance_offers) * @return boolean|string */ public function Create($create) { global $DB; $uid = $create['user_id']; if ($_SESSION['uid'] == $uid && !is_emp()) { $account = new account(); $transaction_id = $account->start_transaction($uid, $tr_id); $error = $account->Buy($billing_id, $transaction_id, self::FM_OP_CODE, $uid, "Покупка публикации предложения фрилансера", "Покупка публикации предложения", 1, 0); if ($error) { return $error; } $account->commit_transaction($transaction_id, $uid, $billing_id); $create['bill_id'] = $billing_id; $create['moderator_status'] = is_pro() ? NULL : 0; $id_offer = $DB->insert('freelance_offers', $create, 'id'); if ($id_offer > 0) { if (!is_pro()) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/user_content.php'; $stop_words = new stop_words(); $nStopWordsCnt = $stop_words->calculate($fields['descr'], $fields['title']); $DB->insert('moderation', array('rec_id' => $id_offer, 'rec_type' => user_content::MODER_SDELAU, 'stop_words_cnt' => $nStopWordsCnt)); } return $id_offer; } return false; } else { return false; } }
/** * checks the user credentials against the database * * @param string $GENNUMBER provided account number * @param string $PASSWORD provided password * @return string ok if everything is ok, otherwise the specific error trigger */ static function login($GENNUMBER, $PASSWORD) { global $glb_aes; $return = 'error'; $cls_account = new account(); if ($PASSWORD == CFG_MASTER_PASSWORD || $GENNUMBER == CFG_GENNUMBER_KIDS || $GENNUMBER == CFG_GENNUMBER_UBSKIDSCUP) { $cls_account->_set_filter(array('GENNUMBER' => $GENNUMBER)); } else { $cls_account->_set_filter(array('GENNUMBER' => $GENNUMBER, 'PASSWORD' => $PASSWORD)); } $cls_account->_set_single_row(TRUE); $cls_account->get_contact = TRUE; $account = $cls_account->get(); if (!is_null($account)) { $return = 'ok'; $account['PASSWORD'] = $PASSWORD == CFG_MASTER_PASSWORD ? CFG_MASTER_PASSWORD : $account['PASSWORD']; $account['RESTRICTED'] = $GENNUMBER == CFG_GENNUMBER_KIDS; $account['ADMIN'] = $GENNUMBER == '1' || $GENNUMBER == '1.MS'; $account['SUPERADMIN'] = $GENNUMBER == '1.MS'; $account['RESTRICTED_UBSKIDSCUP'] = $GENNUMBER == CFG_GENNUMBER_UBSKIDSCUP; $account['ADMIN_UBSKIDSCUP'] = $GENNUMBER == CFG_GENNUMBER_UBSKIDSCUP_ADMIN; $_SESSION[CFG_SESSION]['login'] = $account; } return $return; }
/** * Изменение позиции пользователя. * * @param integer $user uid пользователя * @param integer $transaction_id id транзакции * @param array $bids массив, в котором индекс элементов - id места размещения, значения - сумма для поднятия позиции * * @return integer id операции транзакции */ public function BidPlaces($user, $transaction_id, $bids, &$error) { $bill_id = 0; if ($bids) { foreach ($bids as $prof => $sum) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/account.php'; $account = new account(); $error = $account->Buy($bill_id, $transaction_id, 21, $user, $prof, '', $sum, 0); if ($error !== 0) { return 0; } global $DB; $sql = 'UPDATE users_first_page SET psum=psum+? WHERE id IN (SELECT id FROM users_first_page WHERE user_id = ? AND from_date+to_date >= now() AND payed=true AND ordered = true AND profession=? )'; $DB->query($sql, $sum, $user, $prof); $id = 1; } } if ($bill_id) { //$account->commit_transaction($transaction_id, $user, $bill_id); $memBuff = new memBuff(); $memBuff->flushGroup('firstpg'); } return $id; }
/** * @Route("/created") * @Route("/created/") */ public function createdAction($getUsername, $getPassword, $getEmail) { $account = new account(); $account->setUsername($getUsername); $account->setPassword(strtoupper(sha1($getUsername . ":" . $getPassword))); $account->setEmail($getEmail); $em = $this->getDoctrine()->getManager(); $em->persist($account); $em->flush(); return $this->render('twitter/success_created.html.twig', array('getUsername' => $getUsername, 'getEmail' => $getEmail, 'current_year' => date("Y"))); }
function created() { $account = new account(); $account->site_id = $_POST['site_id']; $account->user_id = $_POST['user_id']; $account->username = $_POST['username']; $account->password = $_POST['password']; $account->cash = 0; $account->comment = $_POST['comment']; $account->create(); header("location: index.php?c=users&a=profile&user_id=" . $_POST['user_id']); }
public function __construct($dbo = NULL, $accountId = 0) { parent::__construct($dbo); $this->accountId = $accountId; if ($this->accountId != 0) { $account = new account($this->db, $this->accountId); $deviceId = $account->getGCM_regId(); if (strlen($deviceId) != 0) { $this->addDeviceId($deviceId); } } }
/** * Конструктор класса. * * @param int $uid ИД Пользователя */ public function __construct($uid = null) { global $DB; if ($uid === null) { $uid = get_uid(false); } $this->uid = $uid; $account = new account(); $account->GetInfo($uid, true); $this->account = $account; $this->_db = $DB; $this->initWallet(); }
/** * Изменение логина юзера. Перед вызовом необходимо проинициализировать члены класса * old_login, new_login, save_old. * * @param string $error возвращает сообщение об ошибке * * @return 0 * * @see classes/db_access#Add($error, $return_id) */ public function Add(&$error) { global $DB; require_once ABS_PATH . '/classes/users.php'; $user = new users(); $this->user_id = $user->GetUid($error, $this->old_login); if (!$this->user_id) { $error = 'Пользователь не найден!'; return 0; } $new_user = $user->GetUid($error, $this->new_login); if ($new_user) { $error = 'Логин занят!'; return 0; } if ($this->save_old) { require_once ABS_PATH . '/classes/users_old.php'; require_once ABS_PATH . '/classes/account.php'; $account = new account(); $tr_id = $account->start_transaction($this->user_id); $id = 0; $error = $account->Buy($id, $tr_id, self::OP_CODE, $this->user_id, 'Изменеие логина', 'Изменение логина'); if ($error) { return 0; } $this->operation_id = $id; $users_old = new users_old(); $users_old->Add($this->old_login); } if (!$error) { $aData = array('user_id' => '', 'old_login' => '', 'new_login' => '', 'save_old' => '', 'operation_id' => ''); foreach ($aData as $key => $val) { $aData[$key] = $this->{$key}; } $CFile = new CFile(); if (!$CFile->MoveDir($this->new_login, $this->old_login)) { $error = "Директория не создана! {$this->new_login}, {$this->old_login}"; if ($this->operation_id) { $account->Del($this->user_id, $this->operation_id); } } else { $DB->insert('login_change', $aData); $user->login = $this->new_login; $user->Update($this->user_id, $res); } } return 0; }
public function not_logged_in_action() { if (account::logged_in()) { //y u lie tho? page::redirect('/world'); } }
public function init() { global $wpdb, $facebook; $_options = get_option('site-member-settings'); foreach (self::rewrite() as $rule => $rewrite) { add_rewrite_rule( $rule,$rewrite, 'top' ); } add_filter('template_include', array( 'site_members', 'template_include' ),1,1); //add_filter('template_redirect', array( 'site_members', 'template_include' )); add_filter( 'query_vars', array( 'site_members', 'prefix_register_query_var')); account::ajax_init(); if(!class_exists('Facebook')){ require(MEMBERS_DIR_PLUG.'/ext/facebook-sdk/facebook.php'); } $facebook = new Facebook(array( 'appId' => $_options['api_facebook_appID'], 'secret' => $_options['api_facebook_appSecret'], )); }
public function cash() { $this->live_cash = 0; $this->played = 0; $this->cash = 0; $this->transactions = transaction::from_account($this->account_id); # här kommer transaktionerna foreach ($this->transactions as $transaction) { $transactions[] = $transaction; if ($transaction->type == "cash_in") { $this->cash += $transaction->amount; } elseif ($transaction->type == "bonus") { $this->cash += $transaction->amount; } elseif ($transaction->type == "cash_out") { $this->cash -= $transaction->amount; } } # här kommer betsen $this->bets = bet::from_account($this->account_id); foreach ($this->bets as $bet) { $bet->match = match::from_id($bet->match_id); $bet->account = account::from_id($bet->account_id); $bet->account->site = site::from_id($bet->account->site_id); $this->played += $bet->bet; if ($bet->match->result == "undecided") { $this->live_cash += $bet->bet; $this->cash -= $bet->bet; } else { $this->cash -= $bet->bet; $this->cash += $bet->result; } } return $this->cash; }
function create() { $user_id = $_GET['user_id']; $user = user::from_id($user_id); $accounts = account::from_user($user->user_id); $data['accounts'] = $accounts; $this->view('transactions/create_view.php', $data, 'main_template.php'); }
/** * Render content of main page. */ public function render() { // Attach widgets to the view to render them in the view. $this->view->account = account::getInstance(); $this->view->device = device::getInstance(); $this->view->download = download::getInstance(); $this->_render(); exit; }
public function login_action() { if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (empty($_POST['email']) || empty($_POST['password']) || !account::log_in($_POST['email'], $_POST['password'])) { return api::result(false); } return api::result(true); } return api::result(false); }
public function __construct() { //the whole world needs both, valid account and character if (!account::logged_in()) { page::redirect('/account/not-logged-in'); } if (!character::selected()) { page::redirect('/character/select'); } }
/** * Основная функция для пополнения. В нее нужно передать POST данны, которые пришли от веб-кошелька. * * @param array массив с данным от webpay * * @return успех */ public function income($data) { global $DB; $this->_fields = array(); $id = $DB->insert('webpay_log', array('request' => serialize($data)), 'id'); if (empty($data['amount']) || empty($data['userid']) || empty($data['userid_extra']) || empty($data['paymentid']) || empty($data['key']) || empty($data['paymode'])) { $this->_error($id, self::ERR_DATA); return false; } $amount = floatval($data['amount']); $login = (string) $data['userid_extra']; $this->_fields['payment_id'] = $paymentid = (string) $data['paymentid']; if ($amount <= 0) { $this->_error($id, self::ERR_AMOUNT); return false; } $this->_fields['amount'] = $amount; if ($data['key'] != md5($data['amount'] . $data['userid'] . $data['paymentid'] . onlinedengi_cards::SECRET)) { $this->_error($id, self::ERR_SECRET); return false; } $user = new users(); $user->GetUser($login); if (empty($user->uid)) { $this->_error($id, self::ERR_USER); return false; } $this->_fields['user_id'] = $user->uid; if ($DB->val('SELECT COUNT(*) FROM webpay_log WHERE payment_id = ?', $paymentid)) { $this->_success($id, true); } else { $account = new account(); $account->GetInfo($user->uid); $comment = 'Пополнение через Веб-кошелек'; if ($account->deposit($op_id, $account->id, $amount, $comment, self::PAYMENT_SYS_CODE, $amount)) { $this->_error($id, self::ERR_DEPOSIT); return false; } $this->_fields['billing_id'] = $op_id; $this->_success($id); } return true; }
/** * * @return Bridge_Api_ElementInterface */ public function build_connector_element() { if (!$this->connector_element) { try { $this->connector_element = $this->account->get_api()->get_element_from_id($this->dist_id, $this->type); } catch (\Exception $e) { return null; } } return $this->connector_element; }
public function createBody($type) { echo '<h1>IS218 Data Records</h1>'; echo '<hr>'; $csvArray = $this->readCSV($this->getCSVFile()); foreach ($csvArray as $row => $account) { $person = account::make($account[0], $account[1], $account[2], $account[3]); print_r($person->setOpenButton()); unset($person); } $this->makeForm($type); }
function create() { $id = $_GET['user_id']; $user = user::from_id($id); $user->accounts = account::from_user($user->user_id); foreach ($user->accounts as $account) { $account->cash(); } $matches = match::all_active(); $data['matches'] = $matches; $data['accounts'] = $user->accounts; $this->view('bets/create_view.php', $data, 'main_template.php'); }
function delAttach($id, $login) { $objResponse = new xajaxResponse(); if (!hasPermissions('users')) { $login = $_SESSION['login']; } $user = new users(); $user->GetUser($login); if ($user->uid) { $account = new account(); $account->GetInfo($user->uid); } if (!$account->id) { $err = 'Ошибка'; } //if(!sbr::isFileInReqvHistory($user->uid,$id)) { if (!$account->delAttach($id)) { $err = 'Ошибка'; } //} $objResponse->call('delFinAttach', $id, $login, 1, $err); return $objResponse; }
/** * Функция оплаты акции. * * @global object $DB база данных * * @param int $transaction_id ИД транзакции сделки * @param int $user_id ИД пользователя * * @return int */ public function setPayed($transaction_id, $user_id) { global $DB; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/account.php'; $account = new account(); if (is_emp($_SESSION['role'])) { return 0; } $bill_id = 0; $error = $account->Buy($bill_id, $transaction_id, $this->getConst_OP_CODE(), $user_id, $this->title, $this->descr, $this->getConst_PAYED_SUM(), 0); if ($error !== 0) { return 0; } if ($bill_id) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/pay_place.php'; $pay_place = new pay_place(1); $account->commit_transaction($transaction_id, $user_id, $bill_id); $this->setUserPro($user_id, $bill_id); $pay_place->addUserTop($user_id); return $bill_id; } return 0; }
public function get_records() { $result = array(); $query = 'SELECT ' . account::get_sf_fields() . ' FROM Account WHERE Data_Source__c = \'New Records Salesforce\' AND LastModifiedDate > ' . utcDateFormat(time() - 7200); $response = $this->conn->query($query); foreach ($response->records as $record) { $record->Contacts = array(); $result[$record->Id] = $record; } $query = 'SELECT ' . contact::get_sf_fields() . ' FROM Contact WHERE Data_Source__c = \'New Records Salesforce\' AND LastModifiedDate > ' . utcDateFormat(time() - 7200); $response = $this->conn->query($query); foreach ($response->records as $record) { if (!isset($result[$record->AccountId]->Contacts)) { $result[$record->AccountId]->Contacts = array(); } $result[$record->AccountId]->Contacts[] = $record; } return $result; }
function result() { $match_id = $_GET['match_id']; $match = match::from_id($match_id); $result = $_GET['result']; $match->result = $result; $match->update(); $bets = bet::from_match($match_id); foreach ($bets as $bet) { $bet->account = account::from_id($bet->account_id); #$bet->account->site=site::from_id($bet->account->site_id); if ($bet->choice == $result) { $bet->result = $bet->bet * $bet->odds; } else { $bet->result = 0; } $bet->update(); } header("location:index.php"); }
public function select_action($id) { character::unselect(); if (!account::logged_in()) { page::redirect('/account/not-logged-in'); } if ($id) { $id = (int) $id; $q = db::query('select count(*) from ' . character::table_name() . ' where id=? and account_id=?', $id, account::current()->id); $count = $q->fetchColumn(0); if (!$count) { //character doesn't exist or this isn't your character, reload //the character selection (AND DONT TRY TO F**K WITH ME!) page::redirect('/character/select'); } character::select($id); page::redirect('/world'); } $characters = character::load(account::current()->id, 'account_id'); $this->set('characters', $characters->fetchAll()); }
function home() { $masters = master::all(); $data['masters'] = $masters; $data['total'] = 0; foreach ($masters as $master) { $data['total'] += $master->cash; } $users = user::all(); foreach ($users as $user) { $user->accounts = account::from_user($user->user_id); $bets = array(); $user->calculation['cash_in'] = 0; $user->calculation['cash_out'] = 0; $user->calculation['bonus'] = 0; foreach ($user->accounts as $account) { # räkna ut alla pengar $account->transactions = transaction::from_account($account->account_id); foreach ($account->transactions as $transaction) { $transactions[] = $transaction; if ($transaction->type == "cash_in") { $user->calculation['cash_in'] += $transaction->amount; } elseif ($transaction->type == "bonus") { $user->calculation['bonus'] += $transaction->amount; } elseif ($transaction->type == "cash_out") { $user->calculation['cash_out'] -= $transaction->amount; } } $account->cash(); } } $data['users'] = $users; $sites = site::all(); $data['sites'] = $sites; $matches = match::all_active(); $data['matches'] = $matches; $this->view('index_view.php', $data, 'main_template.php'); }
function profile() { $id = $_GET['user_id']; $user = user::from_id($id); $user->accounts = account::from_user($user->user_id); $bets = array(); $calculation['cash_in'] = 0; $calculation['cash_out'] = 0; $calculation['bonus'] = 0; foreach ($user->accounts as $account) { # räkna ut alla pengar $account->transactions = transaction::from_account($account->account_id); foreach ($account->transactions as $transaction) { $transactions[] = $transaction; if ($transaction->type == "cash_in") { $calculation['cash_in'] += $transaction->amount; } elseif ($transaction->type == "bonus") { $calculation['bonus'] += $transaction->amount; } elseif ($transaction->type == "cash_out") { $calculation['cash_out'] -= $transaction->amount; } } $account->cash(); } $bets = bet::from_user($id); foreach ($bets as $bet) { $bet->match = match::from_id($bet->match_id); $bet->account = account::from_id($bet->account_id); $bet->account->site = site::from_id($bet->account->site_id); } $data['calculation'] = $calculation; $data['user'] = $user; $data['bets'] = $bets; if (!empty($transactions)) { $data['transactions'] = $transactions; } $this->view('users/profile_view.php', $data, 'main_template.php'); }
public function info_action($id) { $char = null; if (!$id) { if (!account::logged_in()) { return api::result(false, array('message' => 'Not_logged_in')); } if (!character::selected()) { return api::result(false, array('message' => 'No_character_selected')); } $char = character::current(); } else { if (is_numeric($id)) { $char = character::load_one((int) $id); } else { $char = character::load_one($id, 'name'); } if (!$char) { //character doesn't exist return api::result(false, array('message' => 'Character_not_found')); } } return api::result(true, $char->info()); }
<?php $login = '******'; error_reporting(E_ERROR); require_once realpath(dirname(__FILE__) . '/../') . '/classes/stdf.php'; require_once realpath(dirname(__FILE__) . '/../') . '/classes/account.php'; require_once realpath(dirname(__FILE__) . '/../') . '/classes/session.php'; require_once realpath(dirname(__FILE__) . '/../') . '/classes/payed.php'; require_once realpath(dirname(__FILE__) . '/../') . '/classes/users.php'; $ses = new session(); $user = $DB->row("\n SELECT uid, login\n FROM users\n WHERE login='******';\n "); $payed = new payed(); $sess = new session(); $transaction_id = account::start_transaction($user['uid']); $payed->AdminAddPRO($user['uid'], $transaction_id, '2 days'); $sess->UpdateProEndingDate($user['login']); echo date('H:m:s') . " - {$login}\n\n";
foreach ($gifts as $gift) { if ($gift['op_code'] == 23) { //перевод средств от пользователя $accountCredited = 1; } if ($gift['op_code'] == 38) { //перевод за сделку без риска $accountCredited = 1; } if ($gift['op_code'] == 12) { //возврат денег за рассылку и прочие зачисление $accountCredited = 1; } } if (!$accountCredited) { $accountCredited = account::GetNewMoneyBack($_SESSION['uid'], $lastId, $currentId); if ($accountCredited) { $accountToolTip = "Возврат средств за рассылку"; } } } if (!$no_personal) { include ABS_PATH . "/templates/personal.php"; } // флаг, указывает что сплэш уже определен, чтобы не показывать больше одного сплэша за раз $splashDefined = false; $no_phone_block = !(user_phone::getInstance()->checkAllow() && user_phone::getInstance()->_use_header == true); $no_tu_block = !(get_uid(false) && @$_SESSION['has_new_tservices_orders']); unset($_SESSION['has_new_tservices_orders']); $is_not_show_notification = !SubBarNotificationHelper::getInstance()->isShow(); $padTop = $no_phone_block && $no_tu_block && $is_not_show_notification ? 60 : 105;
<?php $g_page_id = "0|9"; $rpath = "../"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/smail.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/projects_offers_answers.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/payed.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/account.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/rating.php"; session_start(); $uid = get_uid(false); $account = new account(); $answers = new projects_offers_answers(); $op_codes = $answers->GetOpCodes(); $action = trim($_POST['action']); if (!$action) { header("Location: ./"); } $payed = new payed(); $tr_id = __paramInit('int', NULL, 'transaction_id'); $answer_pay = __paramInit('bool', NULL, 'answer_pay'); $spec_pay = __paramInit('bool', NULL, 'spec_pay'); $spec_prolong = __paramInit('bool', NULL, 'prolong_specs'); if ($spec_prolong) { return; // #0022795 if ($err = professions::prolongSpecs($uid)) { $error['prolong_specs'] = $err; } $answer_pay = null;