Esempio n. 1
0
 public function actionIndex()
 {
     $use = new Users();
     $user = $use->GetUserAll();
     $dataProvider = new ArrayDataProvider(['allModels' => $user, 'pagination' => ['pageSize' => 10], 'sort' => ['attributes' => ['doctorcode']]]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }
Esempio n. 2
0
 /**
  * Displays event view page.
  *
  * @return mixed
  */
 public function actionShow()
 {
     if (Yii::$app->request->get("eventname") == "") {
         throw new CHttpException(404, 'The specified post cannot be found.');
     }
     $eventname = Yii::$app->request->get("eventname");
     $list = Events::find()->where(['link' => $eventname]);
     if ($list->count() == 0) {
         throw new CHttpException(404, 'The specified post cannot be found.');
     }
     $list = $list->one();
     $org = Users::find()->where(['id' => $list["FK_organizer_id"]])->one();
     $participients = UsersEvents::find()->where(['FK_event_id' => $list->id]);
     $pars = array();
     if ($participients->count() == 0) {
         $participients = false;
     }
     if ($participients) {
         $participients = $participients->all();
         foreach ($participients as $value) {
             $pars[] = $value["id"];
         }
     }
     Users::current()->id;
     $participients = Users::find()->where(['id' => $pars])->all();
     return $this->render('view', ['model' => $list, 'org' => $org, 'participients' => $participients]);
 }
 public function actionIndex()
 {
     $result = Yii::$app->request;
     if ($result->post('event') === 'Login_Event') {
         $login = $result->post('login');
         $password = $result->post('password');
         $user = Users::find()->from('users')->where(['email' => $login, 'password' => $password])->one();
         if (!empty($user)) {
             $ip = Yii::$app->request->getUserIP();
             $id = $user->person_id;
             $sessionId = Helper::generateRandomString(date("Y_m_d_H_i_s"), 15);
             $session = Yii::$app->session;
             $session->setId('' . $sessionId);
             $session->set("login", $login);
             $session->set("IP", $ip);
             $session->set("success", "accept");
             $session->set("id", $id);
             $user->session_id = $sessionId;
             $user->save();
             $answer = 'success';
         } else {
             $answer = 'denied';
         }
         Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
         if ($answer == 'success') {
             return array('event' => 'Login_Event', 'answer' => $answer, 'url' => Yii::$app->urlManager->createUrl(['network/index', 'id' => $id]));
         }
         return array('event' => 'Login_Event', 'answer' => $answer);
     } else {
         return $this->render('index', array());
     }
 }
Esempio n. 4
0
 /**
  * Displays homepage.
  *
  * @return mixed
  */
 public function actionIndex()
 {
     if (Users::getRights() <= 0) {
         $this->layout = 'landing';
     }
     return $this->render('index');
 }
Esempio n. 5
0
    /**
     * Finds user by [[username]]
     *
     * @return User|null
     */
    protected function getUser()
    {
        if ($this->_user === null) {
            $this->_user = Users::findByUsername($this->username);
        }

        return $this->_user;
    }
Esempio n. 6
0
 /**
  * Signs user up.
  *
  * @return DaoUsers|null the saved model or null if saving fails
  */
 public function signup()
 {
     if (\frontend\models\Validator::cyryillic($this->name) && \frontend\models\Validator::email($this->email) && \frontend\models\Validator::login($this->pass)) {
         $user = new Users();
         $user->access = 1;
         $user->image = '';
         $user->name = $this->name;
         $user->pass = md5($this->pass);
         $user->email = $this->email;
         $user->link = (new \frontend\models\Transliterate())->convert($this->name);
         $user->created = time();
         if ($user->save()) {
             $this->login = $user->email;
             $this->pass = $user->pass;
             $this->signin();
             return true;
         }
         return false;
     }
     return false;
 }
Esempio n. 7
0
 /**
  * Sign up page and signing up
  */
 public function actionSignup()
 {
     if (\frontend\models\Users::getRights() > 0) {
         return $this->redirect('/');
     }
     if ($post = Yii::$app->request->post()) {
         $error = '';
         $email = '';
         $pass = '';
         $name = '';
         if (isset($post['email']) && !empty($post['email'])) {
             $email = $post['email'];
         } else {
             $error = 'Введіть, будь ласка, email';
         }
         if (isset($post['pass']) && !empty($post['pass'])) {
             $pass = $post['pass'];
         } else {
             $error = 'Введіть, будь ласка, пароль';
         }
         if (isset($post['name']) && !empty($post['name'])) {
             $name = $post['name'];
         } else {
             $error = 'Введіть, будь ласка, своє ім\'я';
         }
         if (empty($error)) {
             $users = new \frontend\models\Users();
             $users->email = $email;
             $users->name = $name;
             $users->pass = $pass;
             if ($users->signup()) {
                 return $this->redirect('/');
             } else {
                 $error = 'На жаль, неможливо зареєструватися через помилку введення даних.';
             }
         }
         if (!empty($error)) {
             $client_id = '5186189';
             $client_secret = 'WtAeG2nAnSHRaAzIojap';
             $redirect_uri = 'http://epulari/vk-auth';
             $url = 'http://oauth.vk.com/authorize';
             $params = array('client_id' => $client_id, 'redirect_uri' => $redirect_uri, 'response_type' => 'code');
             $vkAuthLink = $url . '?' . urldecode(http_build_query($params));
             return $this->render('signup', ['email' => $email, 'pass' => $pass, 'name' => $name, 'error' => $error, 'vk_link' => $vkAuthLink]);
         }
     }
     return $this->render('signup');
 }
Esempio n. 8
0
 public function actionIndex()
 {
     $query = Users::find()->leftJoin('media', array('id' => 'user_id'))->where(['type' => 1, 'active' => 1]);
     $countQuery = clone $query;
     $pages = new Pagination(['totalCount' => $countQuery->count()]);
     echo $pages;
     die;
     $page = 1;
     if (isset($_REQUEST["page"])) {
         $page = intVal($_REQUEST["page"]);
     }
     $limit = 12;
     $offset = $limit * ($page - 1);
     $pageSize = ceil($countQuery->count() / $limit);
     $pages->setPageSize($pageSize);
     $models = $query->offset($offset)->limit($limit)->all();
     $city = City::find()->all();
     return $this->render('index', ['models' => $models, 'pages' => $pages, 'city' => $city]);
 }
Esempio n. 9
0
 public function actionGetpass()
 {
     $model = new Users();
     $pass = $model->find()->select(['FIELD4'])->where(['FIELD3' => 'telkom'])->scalar();
     echo $this->decrypt($pass);
 }
 public function actionIndex()
 {
     $data = Users::find()->asArray()->all();
     return $this->render('index', ['data' => $data]);
 }
Esempio n. 11
0
 /**
  * Displays current user edit page.
  *
  * @return mixed
  */
 public function actionEdit()
 {
     if (Users::getRights() > 0) {
         return $this->redirect('/');
     }
     $url = Yii::$app->request->get('userurl');
     $error = '';
     if ($post = Yii::$app->request->post()) {
         if (isset($post['email']) && !empty($post['email'])) {
             $email = $post['email'];
         } else {
             $error = 'Введіть, будь ласка, email';
         }
         if (isset($post['pass']) && !empty($post['pass'])) {
             $pass = $post['pass'];
         } else {
             $error = 'Введіть, будь ласка, пароль';
         }
         if (isset($post['name']) && !empty($post['name'])) {
             $name = $post['name'];
         } else {
             $error = 'Введіть, будь ласка, своє ім\'я';
         }
         if (empty($error)) {
             $users = new Users();
             $users->email = $email;
             $users->name = $name;
             $users->pass = $pass;
             if ($users->editUsersData($url)) {
                 //				    return $this->redirect('/events');
             } else {
                 $error = 'На жаль, неможливо увійти через помилку у введенні email та/або паролю.';
             }
         }
     }
     return $this->render('edit', ['user' => (new Users())->getUsersData($url), 'error' => $error]);
 }
Esempio n. 12
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFKOrganizer()
 {
     return $this->hasOne(Users::className(), ['id' => 'FK_organizer_id']);
 }