Example #1
0
 public function index()
 {
     $type = Param::get('type', self::TYPE_THREAD);
     $query = trim_collapse(Param::get('query'));
     $page = Param::get('page', 1);
     $pagination = new SimplePagination($page, self::RESULTS_PERPAGE);
     if (!$query) {
         redirect(APP_URL);
     }
     $results = new stdClass();
     switch ($type) {
         case self::TYPE_THREAD:
             $results = Thread::search($query, $pagination->start_index - 1, $pagination->count + 1);
             // Get other info for each thread
             foreach ($results->result as $thread) {
                 $thread->creator = User::getByID($thread->user_id);
                 $thread->category = Category::getName($thread->category_id);
                 $thread->replies_count = Comment::countAll($thread->id);
             }
             break;
         case self::TYPE_COMMENT:
             $results = Comment::search($query, $pagination->start_index - 1, $pagination->count + 1);
             break;
         case self::TYPE_USER:
             $results = User::search($query, $pagination->start_index - 1, $pagination->count + 1);
             break;
         default:
             throw new PageNotFoundException();
             break;
     }
     $pagination->checkLastPage($results->result);
     $pages = ceil($results->total_result / self::RESULTS_PERPAGE);
     $title = "Search: '{$query}'";
     $this->set(get_defined_vars());
 }
Example #2
0
 /**
  * Stores the posters for each search result and loads view
  */
 public function searchResults($results, $input_title)
 {
     $i = 0;
     foreach ($results as $result) {
         if ($result->Poster != 'N/A') {
             $curl = curl_init();
             // Set some options - we are passing in a useragent too here
             curl_setopt_array($curl, array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => 'http://www.omdbapi.com/?apikey=40364d9f&i=' . $result->imdbID, CURLOPT_USERAGENT => 'Codular Sample cURL Request'));
             // Send the request & save response to $resp
             $results[$i] = json_decode(curl_exec($curl));
             // Close request to clear up some resources
             curl_close($curl);
             $results[$i]->imdbVotes = (int) str_replace(',', '', $results[$i]->imdbVotes);
             if ($results[$i]->imdbVotes > 2000) {
                 $image_url = $result->Title . '-' . $result->Year . '.jpg';
                 copy($result->Poster, '/home/forge/seenjump.com/public/images/posters/' . $image_url);
                 $results[$i]->ImageUrl = $image_url;
             } else {
                 unset($results[$i]);
             }
         } else {
             unset($results[$i]);
         }
         $i++;
     }
     // Get users
     $user = new User();
     $users = $user->search($input_title);
     $view_data['users'] = $users;
     $view_data['results'] = $results;
     $view_data['input_title'] = $input_title;
     return View::make('search_results', $view_data);
 }
Example #3
0
 function testSearch()
 {
     $users = $this->getTableArray('Select * from tbl_user where email like "%user%"', 'email');
     $mUser = new User('Search');
     $mUser->email = 'user';
     $mUserData = $mUser->search()->getData();
     $mUsers = $this->getModelArray($mUserData, 'email');
     $this->assertEquals($users, $mUsers);
 }
Example #4
0
 public function actionIndex()
 {
     $users = new User('search');
     $users->unsetAttributes();
     $users->status = User::STATUS_ACTIVE;
     if (isset($_GET['User']['nick_name'])) {
         $users->nick_name = CHtml::encode($_GET['User']['nick_name']);
     }
     $this->render('index', ['users' => $users, 'provider' => $users->search((int) $this->module->usersPerPage)]);
 }
Example #5
0
 public function testSearch()
 {
     // Create a new model containing search filter info
     $model = new User();
     $model->username = '******';
     // search by username
     $model->password = '******';
     // and by password
     // Search users - this will return a data provider
     $dataProvider = $model->search();
     // Expect one user found
     $this->assertTrue(count($dataProvider->data) == 1);
     $model->username = '******';
     // search by username only
     unset($model->password);
     $dataProvider = $model->search();
     // Expect nothing found
     $this->assertTrue(count($dataProvider->data) == 0);
 }
Example #6
0
 /**
  * Display users list
  */
 public function actionIndex()
 {
     $model = new User('search');
     $model->unsetAttributes();
     if (!empty($_GET['User'])) {
         $model->attributes = $_GET['User'];
     }
     $dataProvider = $model->search();
     $dataProvider->pagination->pageSize = Yii::app()->settings->get('core', 'productsPerPageAdmin');
     $this->render('list', array('model' => $model, 'dataProvider' => $dataProvider));
 }
 public function actionList()
 {
     $model = new User('search');
     $model->unsetAttributes();
     if (isset($_GET['User'])) {
         $model->setAttributes($_GET['User']);
     }
     $dataProvider = $model->search();
     if (isset($_GET['page']) && preg_match("/^\\d+\$/", $_GET['page'])) {
         $dataProvider->pagination->setCurrentPage($_GET['page'] - 1);
     }
     $this->_sendResponse($dataProvider->getData(), 200, $dataProvider->pagination->getItemCount());
 }
Example #8
0
 /**
  * @dataProvider dataProvider_Search
  */
 public function testSearch_WithValidTerms_ReturnsExpectedResults($searchTerms, $numResults, $expectedKeys)
 {
     $user = new User();
     $searchTerms['global_firm_rights'] = null;
     // ignore what setting global_firm_rights has
     $user->setAttributes($searchTerms, true);
     $results = $user->search();
     $data = $results->getData();
     $expectedResults = array();
     if (!empty($expectedKeys)) {
         foreach ($expectedKeys as $key) {
             $expectedResults[] = $this->users($key);
         }
     }
     $this->assertEquals($numResults, $results->getItemCount());
     $this->assertEquals($expectedResults, $data);
 }
 public function googledoneAction()
 {
     $consumer = $this->getGoogleConsumer();
     $return_to = 'http://' . $_SERVER['HTTP_HOST'] . '/login/googledone';
     $response = $consumer->complete($return_to);
     if ($response->status == Auth_OpenID_CANCEL) {
         return $this->alert('取消登入', '/');
     }
     if ($response->status == Auth_OpenID_FAILURE) {
         return $this->alert('登入失敗: ' . $response->message, '/');
     }
     $ax = new Auth_OpenID_AX_FetchResponse();
     $obj = $ax->fromSuccessResponse($response);
     $email = $obj->data['http://axschema.org/contact/email'][0];
     if (!($user = User::search(array('user_name' => 'google://' . $email))->first())) {
         $user = User::insert(array('user_name' => 'google://' . $email));
     }
     Pix_Session::set('user_id', $user->user_id);
     return $this->redirect('/');
 }
 /**
  * handles the entire registration process. checks all error possibilities
  * and creates a new user in the database if everything is fine
  */
 private function registerNewUser()
 {
     if (empty($_POST['user_name'])) {
         $this->error = "USERNAME_EMPTY";
     } elseif (empty($_POST['user_password_new']) || empty($_POST['user_password_repeat'])) {
         $this->error = "PASSWORD_EMPTY";
     } elseif ($_POST['user_password_new'] !== $_POST['user_password_repeat']) {
         $this->error = "PASSWORDS_NOT_MATCH";
     } elseif (strlen($_POST['user_password_new']) < 6) {
         $this->error = "PASSWORD_HELP";
     } elseif (strlen($_POST['user_name']) > 64 || strlen($_POST['user_name']) < 2) {
         $this->error = "USERNAME_INVALID_SIZE";
     } elseif (!preg_match('/^[a-z\\d]{2,64}$/i', $_POST['user_name'])) {
         $this->error = "USERNAME_HELP";
     } elseif (empty($_POST['user_email'])) {
         $this->error = "EMAIL_EMPTY";
     } elseif (strlen($_POST['user_email']) > 64) {
         $this->error = "EMAIL_INVALID_SIZE";
     } elseif (!filter_var($_POST['user_email'], FILTER_VALIDATE_EMAIL)) {
         $this->error = "EMAIL_INVALID_FORMAT";
     } else {
         // escaping, additionally removing everything that could be (html/javascript-) code
         $user_name = $_POST['user_name'];
         $user_email = $_POST['user_email'];
         $user_password = $_POST['user_password_new'];
         $user = new User();
         $query_check_user_name = $user->search($user_name, $user_email);
         if ($query_check_user_name->num_rows == 1) {
             $this->error = "REGISTRATION_EXISTENT_USER";
         } else {
             $query_new_user_insert = $user->register($user_name, $user_password, $user_email);
             if ($query_new_user_insert) {
                 $this->successful = true;
                 $login = new Login();
                 $login->doLogin($user_name, $user_password);
             } else {
                 $this->error = "REGISTRATION_FAILURE";
             }
         }
     }
 }
Example #11
0
<?php

require MODELS_PATH . "user.php";
switch ($route["view"]) {
    case 'create':
        $user = new User();
        $invalid_fields = $user->search($params["post"]);
        $errors_user = get_errors($user->validations, $params["post"]);
        $errors_person = get_errors($user->person->validations, $params["post"]);
        $invalid_password = $user->valid_password($params["post"]["password"], $params["post"]["confirm_password"]);
        if (!$errors_user && !$errors_person && !$invalid_fields["email"] && !$invalid_fields["username"] && !$invalid_password["confirm_password"]) {
            $user->set($params["post"]);
            save_msg_success("Se ha agregado correctamente el nuevo usuario");
            redirect_to("users/new");
        } else {
            $post = $params["post"];
            $route["view"] = "new";
            save_msg_warnings("Por favor, corrige los siguientes campos: <br/><br/>");
        }
        break;
}
 public function account($managerId)
 {
     $limit = $this->config->config['users_on_page'];
     $page = !empty($_GET['page']) ? $_GET['page'] : 1;
     if ($page == 1) {
         $offset = '';
     } else {
         $offset = $limit * ($page - 1);
     }
     $users = new User($managerId);
     $search = Arr::get($_GET, 'search', '');
     $filter = Arr::get($_GET, 'filter', '');
     $group = $this->config->item('default_group', 'ion_auth');
     if ($filter != '' || $search) {
         $users->search($search, $filter, null, $limit, $offset, $managerId);
         JsSettings::instance()->add(array('search' => $search, 'filter' => $filter, 'group' => $group));
         $searchList = true;
     } else {
         $users->getManagerUsers($limit, $offset);
         $searchList = false;
     }
     $groupId = $this->ion_auth->getGroupByName($group)->id;
     $members = $this->ion_auth->getUsersByGroup($group);
     if ($members) {
         $members = $members->getFreeUsersDropdown($managerId, $groupId);
     }
     $limit = $this->config->config['users_on_page'];
     $this->template->set('searchList', $searchList);
     $this->template->set('limit', $limit);
     $this->template->set('users', $users);
     $this->template->set('freeusers', $members);
     $this->template->set('page', $page);
     $this->template->set('c_user', $this->c_user);
     $this->template->set('group', $group);
     $this->template->set('managerAccount', $managerId);
     $this->template->render();
 }
Example #13
0
 if (isset($_GET['iDisplayLength'])) {
     $per_page = $_GET['iDisplayLength'];
 } else {
     $per_page = 50;
 }
 if ($per_page > 500) {
     $per_page = 1;
 }
 if (isset($_GET['iDisplayStart'])) {
     $start = $_GET['iDisplayStart'];
 } else {
     $start = 0;
 }
 $user = new User();
 if (isset($_GET['sSearch']) && $_GET['sSearch']) {
     $users = $user->search($_GET['sSearch'], $start, $per_page, $sortby, $sortdir);
 } else {
     $users = $user->getAllUsers(null, $start, $per_page, $sortby, $sortdir);
 }
 $res = array();
 $res['sEcho'] = $echo;
 if (isset($_GET['sSearch']) && $_GET['sSearch']) {
     $res['iTotalDisplayRecords'] = $user->getUserCount($_GET['sSearch']);
 } else {
     $res['iTotalDisplayRecords'] = $user->getUserCount();
 }
 $res['iTotalRecords'] = count($users);
 $res['aaData'] = array();
 if (count($users)) {
     foreach ($users as $key => $val) {
         extract($val);
Example #14
0
 public function actionResumes()
 {
     $model = new User('search');
     $model->unsetAttributes();
     // clear any default values
     $model->showOnSearch = "Y";
     if (isset($_GET['User'])) {
         $model->attributes = $_GET['User'];
     }
     //send model object for search
     $this->render('resumes', array('dataProvider' => $model->search(), 'model' => $model));
 }
Example #15
0
     $adminMailbox->create($postdata);
     httpResponse();
     break;
 case validateRoute('PATCH', 'admin-mailbox/\\d+'):
     $adminMailbox = new AdminMailbox($db, $user);
     $adminMailbox->update((int) $params[1], $postdata);
     httpResponse();
     break;
 case validateRoute('GET', 'comments'):
     $comments = new Comments($db, $user, $torrent);
     list($result, $totalCount) = $comments->getAllComments((int) $_GET["limit"] ?: 10, (int) $_GET["index"] ?: 0);
     httpResponse($result, $totalCount);
     break;
 case validateRoute('GET', 'search'):
     $sqlerrors = new SqlErrors($db, $user);
     list($result, $totalCount) = $user->search($_GET);
     httpResponse($result, $totalCount);
     break;
 case validateRoute('POST', 'reseed-requests'):
     $logs = new Logs($db, $user);
     $mailbox = new Mailbox($db, $user);
     $torrent = new Torrent($db, $user);
     $reseed = new ReseedRequests($db, $user, $torrent, $mailbox, $logs);
     $reseed->create($postdata);
     httpResponse();
     break;
 case validateRoute('GET', 'nonscene'):
     $adminlogs = new AdminLogs($db, $user);
     $nonscene = new Nonscene($db, $user, $adminlogs);
     httpResponse($nonscene->query());
     break;
Example #16
0
 public function getUsers()
 {
     $q = Input::get('q');
     $skip = Input::get('page');
     if (!$skip) {
         $skip = 0;
     }
     $users = User::search($q)->skip($skip)->take(5)->get();
     return Response::json($users);
 }
Example #17
0
<?php

require_once "../initialize.php";
$input = $_POST['input'];
if (isset($_GET['itemtype'])) {
    if ($_GET['itemtype'] == "user") {
        $users = User::search($input);
    }
} else {
    $users = User::search($input);
}
$tables = array();
if ($users != null) {
    $table = new Table("users", $users);
    array_push($tables, $table);
}
if (count($tables) > 0) {
    echo json_encode($tables);
}
class Table
{
    public $name;
    public $objects;
    function __construct($name, $objects)
    {
        $this->name = $name;
        $this->objects = $objects;
    }
}
Example #18
0
 /**
  * Lists all models.
  */
 public function actionRanking()
 {
     $model = new User('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['User'])) {
         $model->attributes = $_GET['User'];
     }
     $model->dbCriteria->order = 'points DESC';
     if (!Yii::app()->user->getState('group')) {
         $group = Group::model()->findByPk(1);
         if ($group) {
             Yii::app()->user->setState('group', $group);
         } else {
             //TODO: Error handling here
             throw new CHttpException(404, 'The current group is not specified.');
         }
     }
     $model->dbCriteria->compare('group_id', Yii::app()->user->getState('group')->id);
     $this->render('ranking', array('model' => $model->search()));
 }
Example #19
0
<?php

require_once "../initialize.php";
$html = "";
$input = "";
if (isset($_GET['input'])) {
    $input = $_GET['input'];
}
$filename = 0;
if (isset($_GET['itemtype'])) {
    $items = array();
    if ($_GET['itemtype'] == "user") {
        $items = User::search($input);
        if (count($items) > 0) {
            foreach ($items as $item) {
                $filename++;
                $random = rand(0, 1);
                file_put_contents("images/" . $filename . "x" . $random . ".jpg", base64_decode($item->picture));
                $item->picture = HOST . "includes/webservices/images/" . $filename . "x" . $random . ".jpg";
                $html .= "<tr>";
                $html .= "  <td><img src='" . $item->picture . "' height='40' width='40'/></td>";
                $html .= "  <td>" . $item->username . "</td>";
                $html .= "  <td>" . $item->get_full_name() . "</td>";
                $html .= "  <td><a class='btn btn-primary' href='updateuser.php?id=" . $item->id . "'>Update</a></td>";
                $html .= "  <td><button class='btn btn-danger btndelete'>Delete <span hidden>" . $item->id . "</span></button></td>";
                $html .= "</tr>";
            }
            $filename = 0;
            echo $html;
        } else {
            echo "no data";
 public function actionUsers($id)
 {
     Yii::app()->user->can($id, 'manage players', true);
     $myRole = Yii::app()->user->serverRole($id);
     $settings = ServerConfig::model()->findByPk((int) $id);
     if (!$settings || !$settings->user_ftp) {
         $userFtp = false;
     } else {
         $userFtp = true;
     }
     $userFtp = Yii::app()->user->isSuperuser() || $myRole == 'owner' && $userFtp;
     if (isset($_POST['ajax'])) {
         if ($_POST['ajax'] == 'role') {
             $role = @$_POST['role'];
             $user = (int) @$_POST['user'];
             if ($role && ($role == $myRole || !in_array($role, User::$roles) || $role == User::$roles[count(User::$roles) - 1])) {
                 die(Yii::t('mc', 'Invalid role selected.'));
             }
             $user = User::model()->findByPk($user);
             if (!$user) {
                 die(Yii::t('mc', 'Invalid user selected.'));
             }
             if (User::getRoleLevel($myRole) <= $user->getLevel($id)) {
                 die(Yii::t('mc', 'No permission to change that user.'));
             }
             Yii::log('Setting user role of user ' . $user->id . ' for server ' . $id . ' to ' . $role);
             if (!$user->setServerRole($id, $role)) {
                 die(Yii::t('mc', 'Failed to change user role!'));
             }
         } else {
             if ($_POST['ajax'] == 'ftpAccess' && $userFtp) {
                 $access = $_POST['ftpAccess'];
                 $user = (int) $_POST['user'];
                 $user = User::model()->findByPk($user);
                 if (!$user) {
                     die(Yii::t('mc', 'Invalid user selected.'));
                 }
                 Yii::log('Setting FTP access of user ' . $user->id . ' for server ' . $id . ' to ' . $access);
                 if (!$user->setServerFtpAccess($id, $access)) {
                     die(Yii::t('mc', 'Failed to change user role!'));
                 }
             }
         }
         Yii::app()->end();
     }
     $model = $this->loadModel($id);
     Yii::app()->params['view_server_id'] = $id;
     Yii::app()->params['view_role'] = $myRole;
     $users = new User('search');
     $users->unsetAttributes();
     // clear any default values
     if (isset($_GET['User'])) {
         $users->attributes = $_GET['User'];
     }
     $provider = $users->search();
     //hide list enabled and not superuser
     if (Yii::app()->params['hide_userlist'] === true && !Yii::app()->user->isSuperuser() && (strlen($users->name) < 2 || $users->name[0] != '=')) {
         $cond = "((select role from user_server where server_id=" . $id . " and user_id=id) != '' or name=:name)";
         $provider->criteria->params[':name'] = $users->name;
         $provider->criteria->addCondition($cond);
     }
     $provider->criteria->order = 'name asc';
     $this->render('users', array('model' => $model, 'provider' => $provider, 'users' => $users, 'userFtp' => $userFtp));
 }
Example #21
0
 function testSearch()
 {
     $name = "John Doe";
     $password = "******";
     $email = "*****@*****.**";
     $signed_in = 0;
     $test_user = new User($name, $password, $email, $signed_in);
     $test_user->save();
     $name2 = "Jane Boe";
     $password2 = "wordpass";
     $email2 = "*****@*****.**";
     $signed_in2 = 0;
     $test_user2 = new User($name2, $password2, $email2, $signed_in2);
     $test_user2->save();
     $result = User::search($test_user->getName());
     $this->assertEquals($test_user, $result);
 }
<?php

require 'angelList/User.php';
if (isset($_GET['search'])) {
    $page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
    $slug = isset($_GET['slug']) ? $_GET['slug'] : null;
    $User = new User();
    $user = $User->search(array('slug' => $slug, 'include_details' => 'investor'));
}
?>

<?php 
include 'header.php';
?>

<div class="container">

 <div class="row">
  <div class="col-lg-12" align="center">
   <form action="users.php" method="get">
    <input name="slug" class="form-control">
    <input type="submit" class="btn btn-default" name="search">
   </form>
  </div>
 </div>

 <?php 
if (isset($_GET['search']) && isset($user)) {
    ?>
  <div class="row">
 public function actionRequestResetPw($state = '')
 {
     if (Yii::app()->params['reset_token_hours'] <= 0) {
         throw new CHttpException(404, Yii::t('mc', 'The requested page does not exist.'));
     }
     $model = new User();
     $model->unsetAttributes();
     if (isset($_POST['User'])) {
         $state = 'info';
         $user = false;
         if (strlen(@$_POST['User']['email'])) {
             $model->email = '=' . $_POST['User']['email'];
             $prov = $model->search();
             if ($prov->itemCount === 1) {
                 $user = $prov->getData();
                 $user = $user[0];
             }
         }
         if (!$user || $user->email !== $_POST['User']['email']) {
             Yii::app()->user->setFlash('reset-error', Yii::t('mc', 'No account found for this email address.'));
         } else {
             $ll = substr(md5($user->id . '_' . time() . '_' . rand()), 8, 22);
             $tt = time() + Yii::app()->params['reset_token_hours'] * 3600;
             $l = $tt . 'l' . $ll;
             $user->reset_hash = md5($tt . '_' . $ll);
             if (!$user->save(false)) {
                 Yii::log('Error saving password reset hash for user ' . $user->name);
                 Yii::app()->user->setFlash('reset-error', Yii::t('mc', 'Error generating password reset token.'));
             }
             $message = new YiiMailMessage();
             $message->setFrom(array(Yii::app()->params['admin_email'] => Yii::app()->params['admin_name']));
             $message->setTo(array($user->email => $user->name));
             $message->view = 'resetPw';
             $message->setBody(array('name' => $user->name, 'l' => $l, 'host' => Yii::app()->request->getHostInfo(), 'panel' => Yii::app()->request->getBaseUrl(true)));
             Yii::log('Sending password reset email');
             if (!Yii::app()->mail->send($message)) {
                 Yii::log('Error sending assign password reset link to ' . $user->email);
                 Yii::app()->user->setFlash('reset-error', Yii::t('mc', 'Error sending password reset link.'));
             } else {
                 Yii::app()->user->setFlash('reset-success', Yii::t('mc', 'A password reset link has been sent to your email address.'));
             }
         }
         $this->redirect(array('site/requestResetPw', 'state' => 'info'));
     }
     $this->render('requestResetPw', array('model' => $model, 'state' => $state));
 }
Example #24
0
<?php

Route::get('user/search/(:any)', function ($term) {
    $field = Input::get('field', 'username');
    $key = implode('-', array('user', 'search', $field, $term));
    if (!($results = Cache::get($key))) {
        $results = User::search($field, $term);
        Cache::put($key, $results, 10);
    }
    $count = Input::get('count', 20);
    $page = Input::get('page', 0);
    return array_slice($results, $page * $count, $count);
});
Example #25
0
 public function search()
 {
     $full_name = Input::get('search');
     $user_model = new User();
     $matches = $user_model->search($full_name);
     echo json_encode($matches);
 }
Example #26
0
<?php

$PageNumber = isset($_REQUEST['PageNumber']) ? intval($_REQUEST['PageNumber']) : 0;
if ($PageNumber == 0) {
    $PageNumber = 1;
}
$NumPerPage = isset($_REQUEST['NumPerPage']) ? intval($_REQUEST['NumPerPage']) : 0;
if ($NumPerPage == 0) {
    $NumPerPage = 25;
}
$User = new User($db_conn);
$Paginator = new Paginator($_SERVER['PHP_SELF'] . "?PageNumber=##PAGE##", 1);
$Users = $User->search($PageNumber, $NumPerPage);
Example #27
0
<?php

include_once 'common.php';
include_once 'classes/user.php';
$method = $_SERVER['REQUEST_METHOD'];
$jsonData = json_decode(file_get_contents('php://input'));
if ($params = matchUriTemplate('/')) {
    if ($method == "GET") {
        $users = User::search();
        foreach ($users as $idx => $user) {
            $users[$idx] = $user->get();
        }
        json_exit($users, SCHEMA_ROOT . '/user#/definitions/array');
    } elseif ($method == "POST") {
        $existing = User::open($jsonData->username);
        if ($existing) {
            json_error(400, "User already exists", $jsonData->username);
        }
        $user = User::create($jsonData);
        $user->setPassword($user->password);
        $user->save();
        json_exit($user->get(), SCHEMA_ROOT . '/user');
    }
    json_error(405, "Invalid method: {$method}", $method);
} else {
    if ($params = matchUriTemplate('/login')) {
        if ($method == "POST") {
            $user = User::openUsername($jsonData->username);
            if ($user && $user->checkPassword($jsonData->password)) {
                $user->login();
                link_header(JSON_ROOT . '/', 'invalidates');
Example #28
0
<?php

$PageNumber = intval(Request::Field("PageNumber"));
if ($PageNumber == 0) {
    $PageNumber = 1;
}
$NumPerPage = intval(Request::Field("NumPerPage"));
if ($NumPerPage == 0) {
    $NumPerPage = 25;
}
$User = new User();
$config = array("url" => $_SERVER['PHP_SELF']);
$Users = $User->search($PageNumber, $NumPerPage, $config);
$paginate_content = $Paginator->showLinks();
$Message = Request::Field("Message");
$Message = showMessage($Message);
$Smarty->assign("Message", $Message);
$Smarty->assign("Users", $Users);
$Smarty->assign("paginate_content", $paginate_content);
$Smarty->display("dashboard/users.tpl");
Example #29
0
 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     //		$dataProvider=new CActiveDataProvider('User');
     //		$this->render('index',array(
     //			'dataProvider'=>$dataProvider,
     $model = new User('search');
     $model->unsetAttributes();
     if (isset($_GET['User'])) {
         $model->attributes = $_GET['User'];
     }
     $this->render('index', array('dataProvider' => $model->search(), 'model' => $model));
 }
Example #30
0
<?php

require_once "../initialize.php";
$input = $_GET['input'];
$html = "";
$filteredstudents = User::search($input);
if (count($filteredstudents) > 0) {
    foreach ($filteredstudents as $object) {
        $html .= '<tr>';
        $html .= '	<td><img style="height:40px;" src="data:image/jpeg;base64, ' . $object->picture . ' " /></td>';
        $html .= '  <td><a href="student.php?id=' . $object->id . '">' . $object->get_full_name() . '</a></td>';
        if (isset($_GET['schoolid'])) {
            $school = School::get_by_id($_GET['schoolid']);
            $theuser = SchoolUser::getUser($object->id, $school->id);
            if ($theuser) {
                if ($theuser->pending == 1) {
                    $html .= '  <td><button class="btn-small button-flat-primary disabled">Already Pending</button></td>';
                } else {
                    $html .= '<td><button class="btn-small button-flat-action disabled">Member</button></td>';
                }
            } else {
                $html .= '<td><button class="btn-small button-flat-primary btninvite">Invite<span hidden>' . $object->id . '</span></button></td>';
            }
        } else {
            if (isset($_GET['batchid'])) {
                $batch = Batch::get_by_id($_GET['batchid']);
                $theuser = BatchUser::getUser($object->id, $batch->id);
                if ($theuser) {
                    if ($theuser->pending == 1) {
                        $html .= '<td><button class="btn-small button-flat-primary disabled">Already Pending</button></td>';
                    } else {