function gms() { $criteria = new CDbCriteria(); $criteria->condition = 'access_level > 1'; $model = AccountData::model()->count($criteria); return $model; }
public function run() { $criteria = new CDbCriteria(); $criteria->select = '*'; $criteria->condition = 'access_level > 0'; $model = AccountData::model()->with(array('players' => array('select' => 'name, race', 'joinType' => 'INNER JOIN', 'condition' => 'online = 1')))->findAll($criteria); $this->render('widgetGm', array('model' => $model)); }
public function actionIndex() { if (Yii::app()->user->isGuest) { $this->redirect(Yii::app()->homeUrl); } $this->pageTitle = Yii::t('title', 'Character list'); $criteria = new CDbCriteria(); $criteria->select = 'name, account_id, account_name, exp, race, player_class, creation_date'; $criteria->join = 'INNER JOIN ' . Config::db('db') . '.log_referals ON (log_referals.slave_id = t.account_id AND log_referals.master_id = "' . Yii::app()->user->id . '" AND status = "unpaid")'; $referals = Players::model()->findAll($criteria); $form = new LogReferals(); if (isset($_POST['LogReferals'])) { $form->attributes = $_POST['LogReferals']; $check_isset = LogReferals::model()->count('master_id = ' . Yii::app()->user->id . ' AND slave_id = ' . $form->slave_id . ' AND status = "unpaid"'); if ($check_isset != 1) { Yii::app()->user->setFlash('message', '<div class="flash_error">' . Yii::t('pers', 'You have no referrаls.') . '</div>'); $this->refresh(); } $master = AccountData::model()->find('id = ' . Yii::app()->user->id); $check_ip = AccountData::model()->count('id = ' . $form->slave_id . ' AND last_ip = "' . $master->last_ip . '"'); if ($check_ip != 0) { $log = LogReferals::model()->find('master_id = ' . Yii::app()->user->id . ' AND slave_id = ' . $form->slave_id . ' AND status = "unpaid"'); $log->status = 'blocked'; $log->update(false); Yii::app()->user->setFlash('message', '<div class="flash_error">' . Yii::t('pers', 'You have no referrаls.') . '</div>'); $this->refresh(); } $criteria = new CDbCriteria(); $criteria->select = 'exp'; $criteria->condition = 'account_id = ' . $form->slave_id; $criteria->order = 'exp DESC'; $criteria->limit = 1; $check_lvl = Players::model()->find($criteria); if (Info::lvl($check_lvl->exp) < Config::get('referal_level')) { Yii::app()->user->setFlash('message', '<div class="flash_error">' . Yii::t('pers', 'Less than the minimum level.') . '</div>'); $this->refresh(); } $criteria = new CDbCriteria(); $criteria->condition = 'id = ' . Yii::app()->user->id; $money = AccountData::model()->find($criteria); $money[Yii::app()->params->money] = $money[Yii::app()->params->money] + Config::get('referal_bonus'); $money->save(); $criteria = new CDbCriteria(); $criteria->condition = 'id = ' . $form->slave_id; $money = AccountData::model()->find($criteria); $money[Yii::app()->params->money] = $money[Yii::app()->params->money] + Config::get('referal_bonus_ref'); $money->save(); $log = LogReferals::model()->find('master_id = ' . Yii::app()->user->id . ' AND slave_id = ' . $form->slave_id . ' AND status = "unpaid"'); $log->status = 'complete'; $log->update(false); Yii::app()->user->setFlash('message', '<div class="flash_success">' . Yii::t('pers', 'Bonus credit applied!') . '</div>'); $this->refresh(); } $this->render('/pers', array('model' => Players::getPlayers(), 'referals' => $referals)); }
public function actionExpire() { if (Yii::app()->user->isGuest or Yii::app()->user->access_level < Config::get('access_level_admin')) { $this->redirect(Yii::app()->homeUrl); } $this->pageTitle = Yii::t('title', 'Removing expired privileges...'); $today = date("Y-m-d"); $model = AccountData::model()->findAll('expire < "' . $today . '"'); if (isset($_POST['Clear'])) { $model = Yii::app()->ls->createCommand()->update('account_data', array('membership' => '0', 'expire' => null), 'expire < "' . $today . '"'); Yii::app()->user->setFlash('message', '<div class="flash_success">' . Yii::t('main', 'Expired privileges removed!') . '</div>'); $this->refresh(); } $this->render('/admin/check_expire', array('model' => $model)); }
public function action_lostPass() { $data = AccountData::getAccountData($this->post['email_user']); if ($data) { $crypt = new Mcrypt(); $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; $email_body = "<p style='font-size: 12px; font-family: Tahoma;'>Dear User, <br>" . "<br> User email:<b> " . $this->post['email_user'] . "</b> " . "<br> Password:<b> " . trim($crypt->decrypt($data['pass'])) . "</b><br>\n <p style='font-size: 10px; font-family: Tahoma; color: #0B72B5;'>This email was generated automatically, do not reply to.</p>"; mail($post['email_user'], 'Forgot password to the DRUtES application.', $email_body, $headers); $this->msg = 'Temporary password has been sent to email.'; return []; } else { $this->msg = 'The email address does not exist.'; return []; } }
public function authenticate() { $user = AccountData::model()->findByAttributes(array('name' => $this->username)); if ($user === null) { $this->errorCode = self::ERROR_USERNAME_INVALID; } else { if (!$user->validatePassword($this->password)) { $this->errorCode = self::ERROR_PASSWORD_INVALID; } elseif ($user->activated == 0) { $this->errorCode = self::ERROR_PASSWORD_INVALID; } else { $this->_id = $user->id; $this->username = $user->name; $this->setState('access_level', $user->access_level); $this->errorCode = self::ERROR_NONE; } } return !$this->errorCode; }
public function actionCategory($name) { if (Yii::app()->user->isGuest) { $this->redirect(Yii::app()->homeUrl); } $id = WebshopCategory::model()->find('alt_name = "' . $name . '"'); $this->pageTitle = Yii::t('title', 'Webshop') . ': ' . $id->name; $criteria = new CDbCriteria(); $criteria->select = '*'; $criteria->condition = 'category_id = ' . $id->category_id; $pages = new CPagination(Webshop::model()->count($criteria)); $pages->pageSize = Config::get('page_shop'); $pages->applyLimit($criteria); $model = Webshop::model()->findAll($criteria); $form = new Inventory(); $form->scenario = 'buy'; if (isset($_POST['Inventory'])) { $form->attributes = $_POST['Inventory']; if ($form->validate()) { $criteria = new CDbCriteria(); $criteria->select = '*'; $criteria->condition = 'item_id = ' . $form->item_id; $item = Webshop::model()->find($criteria); $real_price = ceil($form->new_amount * ($item->price / $item->amount)); $account = AccountData::model()->findByPk(Yii::app()->user->id); if ($account[Yii::app()->params->money] < $real_price) { Yii::app()->user->setFlash('message', '<div class="flash_error">' . Yii::t('webshop', 'Insufficient funds.') . '</div>'); $this->refresh(); } $criteria = new CDbCriteria(); $criteria->condition = 'id = ' . $form->item_owner . ' AND online = 1'; $online = Players::model()->count($criteria); if ($online == 1) { Yii::app()->user->setFlash('message', '<div class="flash_error">' . Yii::t('webshop', 'Log-out') . '</div>'); $this->refresh(); } $criteria = new CDbCriteria(); $criteria->select = 'MAX(mail_unique_id) as mail_unique_id'; $last_mail_id = Mail::model()->find($criteria); $mail = new Mail(); $mail->mail_unique_id = $last_mail_id->mail_unique_id + 1; $mail->mail_recipient_id = $form->item_owner; $mail->sender_name = 'Admin'; $mail->mail_title = Yii::t('webshop', 'Delivery'); $mail->mail_message = Yii::t('webshop', 'Your purchase has been successful. Thank you, and we hope you enjoy the game!'); $mail->unread = 1; if ($form->item_id == 182400001) { $mail->attached_item_id = 0; $mail->attached_kinah_count = $form->new_amount; } else { $mail->attached_item_id = $this->add_item($form->item_id, $form->item_owner, $form->new_amount); $mail->attached_kinah_count = 0; } $mail->express = 1; $mail->save(false); $account[Yii::app()->params->money] = $account[Yii::app()->params->money] - $real_price; $account->save(false); $log = new LogWebshop(); $log->player_id = $form->item_owner; $log->item = $form->item_id; $log->amount = $form->new_amount; $log->price = $real_price; $log->save(false); Yii::app()->user->setFlash('message', '<div class="flash_success">' . Yii::t('webshop', 'Purchase successful!') . '</div>'); $this->refresh(); } } $this->render('category', array('model' => $model, 'id' => $id, 'form' => $form, 'players' => Players::getPlayers(), 'pages' => $pages)); }
// { // $result = $client->getAccountApiKeys('00000000-0000-0000-0000-0000000000b5'); // Logger::info('Result is: {0}', $result); // print_separator(); // } $createAccountOperationId = null; $contractor = new Contractor(); $contractor->setName('Test contractor ' . uniqid()); $contractor->setTaxPayerNumber('5271711106'); $contractor->setEmail('*****@*****.**'); $contractor->setFax('12312123'); $contractor->setPhone('234234234'); $contractor->setWww('www.esr24.pl'); $employees = array(); $employee = new EmployeeData(); $employee->setFirstName('Jan'); $employee->setLastName('Kowalski'); $employee->setEmail('*****@*****.**'); $employee->setPhone('123123123'); $employees[] = $employee; $data = new AccountData(); $data->setExId('exAccount' . uniqid()); $data->setContractor($contractor); $data->setEmployees($employees); $result = $client->createAccount($data); $createAccountOperationId = $result->getOperationId(); Logger::info('Result is: {0}', $result); print_separator(); $result = $client->getAccountCreationResult($createAccountOperationId); Logger::info('Result is: {0}', $result); print_separator();
public function __construct($vals = null) { if (!isset(self::$_TSPEC)) { self::$_TSPEC = array(1 => array('var' => 'type', 'type' => TType::STRING), 2 => array('var' => 'login', 'type' => TType::STRING), 3 => array('var' => 'password', 'type' => TType::STRING), 4 => array('var' => 'options', 'type' => TType::MAP, 'ktype' => TType::STRING, 'vtype' => TType::STRING, 'key' => array('type' => TType::STRING), 'val' => array('type' => TType::STRING))); } if (is_array($vals)) { if (isset($vals['type'])) { $this->type = $vals['type']; } if (isset($vals['login'])) { $this->login = $vals['login']; } if (isset($vals['password'])) { $this->password = $vals['password']; } if (isset($vals['options'])) { $this->options = $vals['options']; } } }
public function actionView($name) { if (Yii::app()->user->isGuest or Yii::app()->user->access_level < Config::get('access_level_admin')) { $this->redirect(Yii::app()->homeUrl); } $this->pageTitle = Yii::t('title', 'Edit accounts') . ' ' . $name; $criteria = new CDbCriteria(); $criteria->select = '*'; $criteria->condition = 'name = "' . $name . '"'; $model = AccountData::model()->find($criteria); $model->scenario = 'admin_edit'; if (isset($_POST['AccountData'])) { $model->attributes = $_POST['AccountData']; if (isset($_POST['AccountData']['activated'])) { $model->activated = 1; } else { $model->activated = 0; } if (!empty($model->new_password)) { $model->password = $this->hashPassword($model->new_password); } if (empty($model->expire)) { $model->expire = NULL; } if ($model->save()) { Yii::app()->user->setFlash('message', '<div class="flash_success">' . Yii::t('main', 'Accounts modified!') . '</div>'); $this->redirect(Yii::app()->homeUrl . 'admin/account/' . $model->name . '/'); } } $this->render('account_form', array('model' => $model)); }
public function actionXtremetop() { $config = SettingsVote::model()->find(); if (Yii::app()->user->isGuest) { $this->redirect($config->xtremetop_link); } if (isset(Yii::app()->request->cookies['pow_vote_xtremetop']->value)) { $this->redirect(Yii::app()->homeurl); } else { $cookie = new CHttpCookie('pow_vote_xtremetop', Yii::app()->user->id); $cookie->expire = time() + 60 * 60 * 24; Yii::app()->request->cookies['pow_vote_xtremetop'] = $cookie; $current = mktime() - 34560; $check = LogVoteXtremetop::model()->count('date > ' . $current . ' AND login = "******"'); if ($check > 0) { $this->redirect(Yii::app()->homeurl); } $criteria = new CDbCriteria(); $criteria->condition = 'id = ' . Yii::app()->user->id; $money = AccountData::model()->find($criteria); $money[Yii::app()->params->money] = $money[Yii::app()->params->money] + $config->xtremetop_reg; $money->update(); $model = new LogVoteXtremetop(); $model->login = '' . Yii::app()->user->name . ''; $model->type = 1; $model->date = mktime(); $model->status = 'complete'; $model->save(false); $this->redirect($config->xtremetop_link); } }
public function actionIkStatus() { if (!$_POST) { exit; } $model = SettingsPay::model()->find(); $secret_key = $model->secret_key; $ik_shop_id = $model->ik_shop_id; $ik_payment_amount = $_POST['ik_payment_amount']; $ik_payment_id = $_POST['ik_payment_id']; $ik_paysystem_alias = $_POST['ik_paysystem_alias']; $ik_baggage_fields = $_POST['ik_baggage_fields']; $ik_payment_state = $_POST['ik_payment_state']; $ik_trans_id = $_POST['ik_trans_id']; $ik_currency_exch = $_POST['ik_currency_exch']; $ik_fees_payer = $_POST['ik_fees_payer']; $sign_hash = strtoupper(md5($ik_shop_id . ':' . $ik_payment_amount . ':' . $ik_payment_id . ':' . $ik_paysystem_alias . ':' . $ik_baggage_fields . ':' . $ik_payment_state . ':' . $ik_trans_id . ':' . $ik_currency_exch . ':' . $ik_fees_payer . ':' . $secret_key)); if ($_POST['ik_sign_hash'] === $sign_hash) { $log = new LogBilling(); $log->pay_id = $ik_trans_id; $log->sum = $ik_payment_amount; $log->account = $ik_payment_id; $log->status = 'unpaid'; $log->system = 'Interkassa'; $log->save(false); $status = LogBilling::model()->findByPK($ik_trans_id); if ($status->status == 'unpaid') { $criteria = new CDbCriteria(); $criteria->condition = 'name = "' . $ik_payment_id . '"'; $money = AccountData::model()->find($criteria); $money[Yii::app()->params->money] = $money[Yii::app()->params->money] + $ik_payment_amount; $money->save(); $log = LogBilling::model()->findByPK($ik_trans_id); $log->status = 'complete'; $log->save(false); echo 'status - success'; } else { echo 'fail'; exit; } } else { echo 'Hash check failed.'; } }