コード例 #1
0
 /**
  * fetch the user information
  * @return bool
  */
 private function getUserInformation()
 {
     if ($this->status) {
         //Gets the current login UserId
         $this->userId = $this->user->forceGetUserId();
         $this->userId = $this->user->decryptField($this->userId);
         $Object = new UserInformation($this->db, $this->user, $this->connection, $this->status, $this->userId);
         if ($Object->isFieldsAvailable()) {
             $this->data = $Object->getData();
             return true;
         }
         array_push($this->data, ["Status" => "error", "Message" => "Unable to fetch user Information"]);
     } else {
         array_push($this->data, ["Status" => "error", "Message" => "Unable to create Connection"]);
     }
     return false;
 }
コード例 #2
0
ファイル: BaseUsers.php プロジェクト: broschb/cyclebrain
 /**
  * Sets a single UserInformation object as related to this object by a one-to-one relationship.
  *
  * @param      UserInformation $l UserInformation
  * @return     Users The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setUserInformation(UserInformation $v)
 {
     $this->singleUserInformation = $v;
     // Make sure that that the passed-in UserInformation isn't already associated with this object
     if ($v->getUsers() === null) {
         $v->setUsers($this);
     }
     return $this;
 }
コード例 #3
0
ファイル: Profile.php プロジェクト: brahmajiayatas/getweiss
 public function getGeneralPercentate($type)
 {
     $temp = 0;
     $val = 0;
     $userID = Yii::app()->user->getId();
     if ($type == 'general') {
         $model = $this->model()->findByPk($userID);
         $list = array('Gender', 'CityOrPostal', 'MobileNumber');
         foreach ($list as $val) {
             if ($model->{$val}) {
                 $temp += 1;
             }
         }
         $val = round(100 / count($list) * $temp);
     } else {
         if ($type == 'basic' || $type == 'desc') {
             if (UserInformation::model()->findByAttributes(array("UserId" => $userID))) {
                 $model = UserInformation::model()->findByAttributes(array("UserId" => $userID));
                 if ($type == 'basic') {
                     $list = array('Orientation', 'LookingFor', 'Children', 'Education', 'Occupation', 'Religion', 'Income', 'Height', 'Weight', 'Eyes', 'HairColour', 'EthnicOrigin', 'Smoke', 'MaritalStatus', 'WantChildren', 'PractisingReligion', 'Build', 'Glasses', 'FacialHair', 'Diet');
                 } else {
                     if ($type == 'desc') {
                         $list = array('UserStatus', 'AboutMe', 'IamLookingFor');
                     }
                 }
                 foreach ($list as $val) {
                     if ($model->{$val}) {
                         $temp += 1;
                     }
                     $val = round(100 / count($list) * $temp);
                 }
             }
         }
     }
     return $val;
 }
コード例 #4
0
<?php

include_once 'UserInformation.php';
$userInformation = new UserInformation();
$os = $userInformation->getOperatingSystem();
$deviceArray = $userInformation->getDeviceArray();
$viewFile = './view/shortcutIcon/for' . $os . '.html';
if (is_file($viewFile)) {
    foreach ($deviceArray as $device) {
        if ($os == $device) {
            include_once $viewFile;
        }
    }
} else {
    // TODO  리팩토링 필요.
    $connection = mysql_connect('mysql2.hosting.paran.com', 'jejunubus', 'sne95ic19');
    mysql_select_db("jejunubus_db", $connection);
    mysql_query("set names 'utf8'");
    $query = "INSERT INTO unknownDevice(unknownOs) VALUES('{$os}') ON DUPLICATE KEY UPDATE unknownOs = '{$os}'";
    if (!mysql_query($query, $connection)) {
        die('Error : ' . mysql_error());
    }
    mysql_close($connection);
    include_once './view/shortcutIcon/forUnknown.html';
}
コード例 #5
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      UserInformation $value A UserInformation object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(UserInformation $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getUserId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
コード例 #6
0
 public function viewprofile($page = '', $filter = '')
 {
     $user = Confide::user();
     $user_id = $user->id;
     $data = array();
     $data['user_id'] = $user_id;
     $data['user'] = $user;
     if ($user_id > 0) {
         $profile = User::leftJoin('users_roles', 'users.id', '=', 'users_roles.user_id')->join('roles', 'roles.id', '=', 'users_roles.role_id')->select('users.*', 'roles.name as rolename')->where('users.id', '=', $user_id)->get();
         if ($profile) {
             $data['profile'] = $profile->first()->toArray();
         }
     }
     $data['page'] = $page;
     $data['filter'] = $filter;
     $balance = new Balance();
     $order = new Order();
     $market = new Market();
     $wallet = new Wallet();
     $setting = new Setting();
     $data['disable_points'] = $setting->getSetting('disable_points', 0);
     switch ($page) {
         case 'balances':
             $wallets = Wallet::orderBy('name')->get()->toArray();
             foreach ($wallets as $key => $value) {
                 $wallet_id = $value['id'];
                 //get balance
                 $balance_amount = $balance->getBalance($wallet_id);
                 $wallets[$key]['balance'] = sprintf('%.8f', $balance_amount);
                 //get PENDING DEPOSITS
                 $deposit_pendding = Deposit::where('user_id', '=', $user_id)->where('wallet_id', '=', $wallet_id)->where('paid', '=', 0)->sum('amount');
                 $wallets[$key]['deposit_pendding'] = sprintf('%.8f', $deposit_pendding);
                 //get PENDING WITHDRAWALS
                 $withdraw_pendding = Withdraw::where('user_id', '=', $user_id)->where('wallet_id', '=', $wallet_id)->where('status', '=', 0)->sum('amount');
                 $wallets[$key]['withdraw_pendding'] = sprintf('%.8f', $withdraw_pendding);
                 //get HELD FOR ORDERS
                 //giao dich ban se giam tien cua wallet hien tai, doi voi btc/ltc (dong tien trao doi) thi giao dich mua se giam tien no
                 //vi vay can xac dinh dau la btc/ltc, bang cach dua vao market, wallet_to trong market chinh la dong tien chinh de trao doi
                 $wallets_to = Market::select("market.wallet_to")->distinct()->get();
                 $wal_to = array();
                 foreach ($wallets_to as $value) {
                     $wal_to[] = $value->wallet_to;
                 }
                 //$wallets_to = array_column($market, 'wallet_to');
                 $status_active = $order->getStatusActive();
                 /*if(in_array($wallet_id,$wal_to)){
                       $held_order = Order::leftJoin('market', 'orders.market_id', '=', 'market.id')
                                   ->where('market.wallet_to','=',$wallet_id)
                                   ->where('orders.user_id','=',$user_id)
                                   ->whereIn('status', $status_active)
                                   ->sum('to_value');
                   }else{*/
                 $held_order = Order::leftJoin('market', 'orders.market_id', '=', 'market.id')->where('market.wallet_from', '=', $wallet_id)->where('orders.user_id', '=', $user_id)->where('type', '=', 'sell')->whereIn('status', $status_active)->sum('from_value');
                 //}
                 $wallets[$key]['held_order'] = sprintf('%.8f', $held_order);
             }
             //echo "<pre>ggg?: "; print_r($wallets); echo "</pre>";
             $data['balances'] = $wallets;
             break;
         case 'orders':
             $record_per_page = 15;
             if (empty($_GET['pager_page'])) {
                 $pager_page = 1;
             } else {
                 $pager_page = $_GET['pager_page'];
             }
             $data['cur_page'] = $pager_page;
             $offset_start = ($pager_page - 1) * $record_per_page;
             $select = "select a.*, b.wallet_from as `from`, b.wallet_to as `to` from orders a left join market b on a.market_id=b.id where a.user_id='" . $user_id . "' ";
             if ($filter != '') {
                 $data['current_coin'] = $wallet->getType($filter);
                 $select .= " AND (b.wallet_to='" . $filter . "' OR b.wallet_from='" . $filter . "') ";
             }
             if (isset($_GET['do_filter'])) {
                 if (!empty($_GET['market'])) {
                     $select .= " AND a.market_id='" . $_GET['market'] . "'";
                 }
                 if ($_GET['status'] != '') {
                     $select .= " AND a.status='" . $_GET['status'] . "'";
                 }
                 if ($_GET['type'] != '') {
                     $select .= " AND a.type='" . $_GET['type'] . "'";
                 }
             }
             $select_count = $select;
             $total_records = DB::select($select_count);
             $data['total_pages'] = ceil(count($total_records) / $record_per_page);
             $select .= " order by `created_at` desc limit " . $offset_start . "," . $record_per_page;
             $ordershistory = DB::select($select);
             //echo "<pre>ordershistory: "; print_r($ordershistory); echo "</pre>";
             //echo "<pre>".dd(DB::getQueryLog())."</pre>";
             $data['ordershistories'] = $ordershistory;
             $markets = Market::get();
             $market_wallet = array();
             foreach ($markets as $value) {
                 $market_wallet[$value->id] = $market->getWalletType($value->id);
             }
             $data['markets'] = $market_wallet;
             break;
         case 'trade-history':
             $record_per_page = 15;
             if (empty($_GET['pager_page'])) {
                 $pager_page = 1;
             } else {
                 $pager_page = $_GET['pager_page'];
             }
             $data['cur_page'] = $pager_page;
             $offset_start = ($pager_page - 1) * $record_per_page;
             $select = "select a.*, b.wallet_from as `from`, b.wallet_to as `to` from trade_history a left join market b on a.market_id=b.id where (a.seller_id='" . $user_id . "' OR a.buyer_id ='" . $user_id . "') ";
             if ($filter != '') {
                 $data['current_coin'] = $wallet->getType($filter);
                 $select .= " AND (b.wallet_to='" . $filter . "' OR b.wallet_from='" . $filter . "') ";
             }
             if (isset($_GET['do_filter'])) {
                 if (!empty($_GET['market'])) {
                     $select .= " AND a.market_id='" . $_GET['market'] . "'";
                 }
                 if (!empty($_GET['type'])) {
                     $select .= " AND a.type='" . $_GET['type'] . "'";
                 }
             }
             $select_count = $select;
             $total_records = DB::select($select_count);
             //echo "<pre>total_records: "; print_r($total_records); echo "</pre>"; exit;
             $data['total_pages'] = ceil(count($total_records) / $record_per_page);
             $select .= " order by `created_at` desc limit " . $offset_start . "," . $record_per_page;
             $trades = DB::select($select);
             $data['tradehistories'] = $trades;
             $markets = Market::get();
             $market_wallet = array();
             foreach ($markets as $value) {
                 $market_wallet[$value->id] = $market->getWalletType($value->id);
             }
             $data['markets'] = $market_wallet;
             break;
         case 'deposits':
             $deposits = Deposit::leftJoin('wallets', 'deposits.wallet_id', '=', 'wallets.id')->select('deposits.*', 'wallets.name', 'wallets.type')->where('user_id', '=', $user_id);
             if ($filter != '') {
                 $data['current_coin'] = $wallet->getType($filter);
                 $deposits = $deposits->where('deposits.wallet_id', '=', $filter);
             }
             if (isset($_POST['do_filter'])) {
                 if (isset($_POST['wallet']) && $_POST['wallet'] != '') {
                     $deposits = $deposits->where('wallet_id', '=', $_POST['wallet']);
                 }
                 if ($_POST['status'] != '') {
                     $deposits = $deposits->where('paid', '=', $_POST['status']);
                 }
             }
             $deposits = $deposits->orderBy('created_at', 'desc')->get();
             //echo "<pre>_POST: "; print_r($_POST); echo "</pre>";
             //echo "<pre>"; echo dd(DB::getQueryLog()); echo "</pre>";
             $data['deposits'] = $deposits;
             $wallets = Wallet::select('id', 'type', 'name')->get();
             $data['wallets'] = $wallets;
             break;
         case 'withdrawals':
             $withdrawals = Withdraw::leftJoin('wallets', 'withdraws.wallet_id', '=', 'wallets.id')->select('withdraws.*', 'wallets.name', 'wallets.type')->where('user_id', '=', $user_id);
             if ($filter != '') {
                 $data['current_coin'] = $wallet->getType($filter);
                 $withdrawals = $withdrawals->where('withdraws.wallet_id', '=', $filter);
             }
             if (isset($_POST['do_filter'])) {
                 if ($_POST['wallet'] != '') {
                     $withdrawals = $withdrawals->where('wallet_id', '=', $_POST['wallet']);
                 }
                 if ($_POST['status'] != '') {
                     $withdrawals = $withdrawals->where('status', '=', $_POST['status']);
                 }
             }
             $withdrawals = $withdrawals->orderBy('created_at', 'desc')->get();
             //echo "<pre>_POST: "; print_r($_POST); echo "</pre>";
             //echo "<pre>"; echo dd(DB::getQueryLog()); echo "</pre>";
             $data['withdrawals'] = $withdrawals;
             $wallets = Wallet::select('id', 'type', 'name')->get();
             $data['wallets'] = $wallets;
             break;
         case 'viewtranferin':
             $record_per_page = 15;
             if (empty($_GET['pager_page'])) {
                 $pager_page = 1;
             } else {
                 $pager_page = $_GET['pager_page'];
             }
             $data['cur_page'] = $pager_page;
             $offset_start = ($pager_page - 1) * $record_per_page;
             //$offset_end = ($pager_page*$record_per_page)-1;
             $select = "select a.*, b.type, b.name , c.username from transfer_history a left join wallets b on a.wallet_id=b.id left join users c on a.receiver=c.id where a.receiver='" . $user_id . "'";
             $select_count = "select count(*) as total from transfer_history a where a.receiver='" . $user_id . "'";
             if ($filter != '') {
                 $data['current_coin'] = $wallet->getType($filter);
                 $select .= " AND a.wallet_id='" . $filter . "'";
             }
             $where = '';
             if (isset($_GET['do_filter'])) {
                 if ($where == '') {
                     if (!empty($_GET['wallet'])) {
                         $where = $where . " AND a.wallet_id='" . $_GET['wallet'] . "'";
                     }
                 }
             }
             $select_count = $select_count . " " . $where . " order by `created_at` desc";
             $total_records = DB::select($select_count);
             //echo "<pre>total_records: "; print_r($total_records); echo "</pre>"; exit;
             $data['total_pages'] = ceil($total_records[0]->total / $record_per_page);
             $select .= " " . $where . " order by `created_at` desc limit " . $offset_start . "," . $record_per_page;
             $transferins = DB::select($select);
             $data['transferins'] = $transferins;
             $wallets_temp = Wallet::get();
             $wallets = array();
             foreach ($wallets_temp as $wallet) {
                 $wallets[$wallet->id] = $wallet;
             }
             $data['wallets'] = $wallets;
             break;
         case 'viewtranferout':
             $record_per_page = 2;
             if (empty($_GET['pager_page'])) {
                 $pager_page = 1;
             } else {
                 $pager_page = $_GET['pager_page'];
             }
             $data['cur_page'] = $pager_page;
             $offset_start = ($pager_page - 1) * $record_per_page;
             //$offset_end = ($pager_page*$record_per_page)-1;
             $select = "select a.*, b.type, b.name , c.username from transfer_history a left join wallets b on a.wallet_id=b.id left join users c on a.sender=c.id where a.sender='" . $user_id . "'";
             $select_count = "select count(*) as total from transfer_history a where a.sender='" . $user_id . "'";
             if ($filter != '') {
                 $data['current_coin'] = $wallet->getType($filter);
                 $select .= " AND a.wallet_id='" . $filter . "'";
             }
             $where = '';
             if (isset($_GET['do_filter'])) {
                 if ($where == '') {
                     if (!empty($_GET['wallet'])) {
                         $where = $where . " AND a.wallet_id='" . $_GET['wallet'] . "'";
                     }
                 }
             }
             $select_count = $select_count . " " . $where . " order by `created_at` desc";
             $total_records = DB::select($select_count);
             //echo "<pre>total_records: "; print_r($total_records); echo "</pre>";
             $data['total_pages'] = ceil($total_records[0]->total / $record_per_page);
             $select .= " " . $where . " order by `created_at` desc limit " . $offset_start . "," . $record_per_page;
             $transferouts = DB::select($select);
             $data['transferouts'] = $transferouts;
             $wallets_temp = Wallet::get();
             $wallets = array();
             foreach ($wallets_temp as $wallet) {
                 $wallets[$wallet->id] = $wallet;
             }
             $data['wallets'] = $wallets;
             break;
         case 'dashboard':
             $total_trades = Trade::where('seller_id', $user_id)->orwhere('buyer_id', $user_id)->get()->toArray();
             $data['total_trades'] = count($total_trades);
             $order = new Order();
             $total_openordes = Order::where('user_id', $user_id)->whereIn('status', $order->getStatusActive())->get()->toArray();
             $data['total_openordes'] = count($total_openordes);
             $twentyfourhours = date('Y-m-d H:i:s', strtotime('-24 hour'));
             $deposit_twentyfourhours = Deposit::where('user_id', $user_id)->where('created_at', ">=", $twentyfourhours)->get()->toArray();
             $data['deposit_twentyfourhours'] = count($deposit_twentyfourhours);
             $withdraw_twentyfourhours = Withdraw::where('user_id', $user_id)->where('created_at', ">=", $twentyfourhours)->get()->toArray();
             $data['withdraw_twentyfourhours'] = count($withdraw_twentyfourhours);
             $deposit_pendings = Deposit::where('user_id', $user_id)->where('paid', 0)->get()->toArray();
             $data['deposit_pendings'] = count($deposit_pendings);
             $total_referred = User::where('referral', $user->username)->get()->toArray();
             $data['total_referred'] = count($total_referred);
             //echo "<pre>total_referred: "; print_r($total_referred); echo "</pre>";
             break;
         case "ecoinstraderpoint":
             $setting = new Setting();
             $data['point_per_btc'] = $setting->getSetting('point_per_btc', 1);
             $data['percent_point_reward_trade'] = $setting->getSetting('percent_point_reward_trade', 0);
             $data['percent_point_reward_referred_trade'] = $setting->getSetting('percent_point_reward_referred_trade', 0);
             break;
         case "verify":
             $userinfo = UserInformation::where('user_id', $user_id)->first();
             //echo "<pre>userinfo: "; print_r($userinfo); echo "</pre>";
             $data['userinfo'] = $userinfo;
             break;
     }
     return View::make('user.profile', $data);
 }
コード例 #7
0
 public function deleteUSer()
 {
     $user_id = Input::get('user_id');
     $user = User::find($user_id);
     if (isset($user->id)) {
         DB::table('users_roles')->where('user_id', $user_id)->delete();
         UserInformation::where("user_id", $user_id)->delete();
         UserAddressDeposit::where("user_id", $user_id)->delete();
         Balance::where("user_id", $user_id)->delete();
         LoginHistory::where("user_id", $user_id)->delete();
         Deposit::where("user_id", $user_id)->delete();
         Withdraw::where("user_id", $user_id)->delete();
         Order::where('user_id', $user_id)->delete();
         //ko nen xoa transfer va trade vi no gan voi 1 user nhan/user mua(ban), nen neu xoa thi se xoa luon lich su cua nguoi khac
         User::where('id', $user_id)->delete();
         $message = $user->username . " " . Lang::get('admin_messages.delete_success');
         if (Input::get('isAjax')) {
             echo json_encode(array('status' => 'success', 'message' => $message));
             exit;
         } else {
             return Redirect::to('admin/manage/users')->with('success', $message);
         }
     } else {
         $message = Lang::get('admin_messages.user_not_exist');
         if (Input::get('isAjax')) {
             echo json_encode(array('status' => 'error', 'message' => $message));
             exit;
         } else {
             return Redirect::to('admin/manage/users')->with('error', $message);
         }
     }
 }