Example #1
0
 /**
  * @covers User::getAllUsers
  */
 public function testGetAllUsers()
 {
     $users = $this->object->getAllUsers();
     $this->assertInternalType('array', $users, 'Return should be an array');
     $this->assertNotCount(0, $users, 'Array should contain at least 1 user');
     $this->assertInstanceOf('User', $users[0], 'Array should contain User class');
 }
 public function getSearch()
 {
     $this_user = Session::get('user');
     $users = User::getAllUsers($this_user);
     // make a list of user_ids that have a filled relationship_status
     $withRelationships = array();
     foreach ($users as $user) {
         if ($user->relationship_status != NULL && !in_array($user->user_id, $withRelationships)) {
             $withRelationships[] = $user->user_id;
         }
     }
     for ($x = 0; $x < count($users); $x++) {
         if ($users[$x]->user_id == $this_user->user_id) {
             unset($users[$x]);
         }
     }
     $users1 = array_values($users);
     unset($users);
     for ($x = 0; $x < count($users1); $x++) {
         if ($users1[$x]->relationship_target == $this_user->user_id && $users1[$x]->relationship_status == 'active') {
             unset($users1[$x]);
         }
     }
     $users = array_values($users1);
     for ($x = 0; $x < count($users); $x++) {
         if ($users[$x]->relationship_status == NULL && in_array($users[$x]->user_id, $withRelationships)) {
             unset($users[$x]);
         }
     }
     $users1 = array_values($users);
     unset($users);
     return View::make('connection.search', array('users' => $users1, 'this_user' => $this_user));
 }
Example #3
0
 static function getByLogin($login)
 {
     $returnedUser = new User();
     $users = User::getAllUsers();
     foreach ($users as $user) {
         if ($user->getLogin() == $login) {
             $returnedUser = $user;
         }
     }
     return $returnedUser;
 }
Example #4
0
 public function getUsers()
 {
     $users = User::getAllUsers();
     $grpUsers = array();
     foreach ($users as $user) {
         if ($user->inGroup($this->name)) {
             $grpUsers[] = $user;
         }
     }
     return $grpUsers;
 }
Example #5
0
 /**
  * @group 47156
  */
 public function testCorrectUserListOutput()
 {
     $this->user1 = $this->createUser(11, 'Active');
     $this->user2 = $this->createUser(12, 'Inactive');
     $allUsers = User::getAllUsers();
     $this->assertArrayHasKey($this->user1->id, $allUsers);
     $this->assertArrayHasKey($this->user2->id, $allUsers);
     $dbManager = $GLOBALS['db'];
     $dbManager->query('DELETE FROM users WHERE id IN (' . $dbManager->quoted($this->user1->id) . ', ' . $dbManager->quoted($this->user2->id) . ')');
     $dbManager->query('DELETE FROM user_preferences WHERE assigned_user_id IN (' . $dbManager->quoted($this->user1->id) . ', ' . $dbManager->quoted($this->user2->id) . ')');
     $dbManager->query('DELETE FROM teams WHERE associated_user_id IN (' . $dbManager->quoted($this->user1->id) . ', ' . $dbManager->quoted($this->user2->id) . ')');
     $dbManager->query('DELETE FROM team_memberships WHERE user_id IN (' . $dbManager->quoted($this->user1->id) . ', ' . $dbManager->quoted($this->user2->id) . ')');
 }
Example #6
0
 public function getUsers()
 {
     $users = User::getAllUsers();
     $found = [];
     foreach ($users as $user) {
         $companies = $user->getCompanies();
         foreach ($companies as $company) {
             if ($company->id == $this->id) {
                 $found[] = $user;
             }
         }
     }
     return $found;
 }
Example #7
0
 public function ajax()
 {
     /**@$Logger This for instantiate of new translog.*/
     /**@$SOP This for instantiate of  new sophisticated.*/
     /**@$USER This for instantiate of new user.*/
     /**@$type This for input type.*/
     $Logger = new TransLog();
     $UserModel = new User();
     $type = Input::get('type');
     if ($type) {
         switch ($type) {
             case 'users-list':
                 $pending = $UserModel->getAllUsers();
                 $dtResult = GlobalController::setDatatable($pending, array('id', 'user_fname', 'user_lname', 'user_email', 'user_username', 'user_status', 'user_type'), 'id');
                 foreach ($dtResult['objResult'] as $aRow) {
                     try {
                         $usertype = $UserModel->getUserType($aRow->id);
                         $pro = $usertype->user_type;
                     } catch (Exception $ex) {
                         $pro = 0;
                     }
                     switch ($pro) {
                         case 1:
                             $pro = 'Admin';
                             break;
                         case 2:
                             $pro = 'Default';
                             break;
                     }
                     $data = array($aRow->id, $aRow->user_fname, $aRow->user_lname, $aRow->user_email, $aRow->user_username, $aRow->user_status ? "Active" : "Inactive", $pro, 'Action');
                     $dtResult['aaData'][] = $data;
                 }
                 unset($dtResult['objResult']);
                 echo json_encode($dtResult);
                 break;
         }
     }
 }
Example #8
0
function getAllUsersDT()
{
    global $bdd, $_TABLES;
    if (!is_null($bdd) && !is_null($_TABLES)) {
        $content = '<thead>';
        $content .= '<tr>';
        $content .= '<th>Id</th>';
        $content .= '<th>Name</th>';
        $content .= '<th>Login</th>';
        $content .= '<th>Pass</th>';
        $content .= '<th>Valid</th>';
        $content .= '<th>Action</th>';
        $content .= '</tr>';
        $content .= '</thead>';
        $content .= '<tbody>';
        $objUser = new User($bdd, $_TABLES);
        $users = $objUser->getAllUsers();
        if ($users) {
            foreach ($users as $key => $user) {
                $content .= '<tr user_id=' . $user->id . '>';
                $content .= '<td>' . $user->id . '</td>';
                $content .= '<td><input type="text" class="input_dt input_dt_name" value="' . $user->name . '" /></td>';
                $content .= '<td><input type="text" class="input_dt input_dt_login" value="' . $user->login . '" /></td>';
                $content .= '<td><input type="text" class="input_dt input_dt_pass" value="" /></td>';
                $content .= '<td><input type="checkbox" class="input_dt input_dt_valid" value="' . $user->valid . '" /></td>';
                $content .= "<td><input type='button' class='edit edit_user_dt' value='Save' />\n\t\t\t\t    <input type='button' class='delete delete_user_dt' value='Supprimer' /></td>";
                $content .= '</tr>';
            }
        }
        $content .= '</tbody>';
        return $content;
    } else {
        error_log("BDD ERROR : " . json_encode($bdd));
        error_log("TABLES ERROR : " . json_encode($_TABLES));
    }
}
 function process()
 {
     if ($this->login == 'anonymous') {
         return false;
     }
     if ($this->login) {
         $info = User::getInfo($this->login);
     }
     $req =& Request::getInstance();
     $tmpPassword = @$info['password'];
     $passwordMd5OrNot = !empty($tmpPassword) ? $tmpPassword : '';
     if ($req->getActionName() === 'modCur') {
         $formElements = array(array('hidden', 'form_login', $this->login), array('password', 'form_passwordold', "Old password:", 'value=""'), array('password', 'form_password', "New password:", 'value=""'), array('password', 'form_password2', $GLOBALS['lang']['admin_type_again'], 'value=""'), array('text', 'form_alias', "Alias", 'size=40 value="' . @$info['alias'] . '"'), array('text', 'form_email', "email", 'value="' . @$info['email'] . '"'), array('radio', 'form_send_mail', $GLOBALS['lang']['install_send_mail'], $GLOBALS['lang']['install_oui'], 'yes'), array('radio', 'form_send_mail', null, $GLOBALS['lang']['install_non'], 'no'));
         $formRules = array(array('form_email', $GLOBALS['lang']['admin_valid_email'], 'email', '', 'server'), array('form_email', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['admin_admin_mail']), 'required'), array('form_passwordold', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['admin_user_oldPwd']), 'required'), array('form_passwordold', $GLOBALS['lang']['admin_user_oldPwd_bad'], 'checkOldCurrentPassword'), array('form_password', $GLOBALS['lang']['admin_valid_pass'], 'complexPassword'), array('form_password', $GLOBALS['lang']['admin_match_pass'], 'compareField', 'form_password2'), array('form_password', $GLOBALS['lang']['admin_valid_pass'], 'changePassword'));
     } else {
         $formElements = array(array('password', 'form_password', "Password:", 'value="' . $passwordMd5OrNot . '"'), array('password', 'form_password2', $GLOBALS['lang']['admin_type_again'], 'value="' . $passwordMd5OrNot . '"'), array('text', 'form_alias', "Alias", 'size=40 value="' . @$info['alias'] . '"'), array('text', 'form_email', "email", 'value="' . @$info['email'] . '"'), array('radio', 'form_send_mail', $GLOBALS['lang']['install_send_mail'], $GLOBALS['lang']['install_oui'], 'yes'), array('radio', 'form_send_mail', null, $GLOBALS['lang']['install_non'], 'no'));
         $formRules = array(array('form_email', $GLOBALS['lang']['admin_valid_email'], 'email', '', 'server'), array('form_email', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['admin_admin_mail']), 'required'), array('form_password', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['install_mdpadmin']), 'required'), array('form_password', $GLOBALS['lang']['admin_valid_pass'], 'complexPassword'), array('form_password', $GLOBALS['lang']['admin_match_pass'], 'compareField', 'form_password2'));
     }
     // when adding a new element, add an input named login
     // else read the login in url
     if ($req->getActionName() === 'add') {
         $formElements = array_merge(array(array('text', 'form_login', "Login:", 'value=""')), $formElements);
         $formRules[] = array('form_login', sprintf($GLOBALS['lang']['admin_required'], "Login"), 'required');
         $formRules[] = array('form_login', "Alpha numeric only", 'alphanumeric');
         if ($login = $this->getSubmitValue('form_login')) {
             $all = array_keys(User::getAllUsers());
             if (in_array($login, $all)) {
                 $this->setElementError('form_login', 'Login already exist in database!');
             }
         }
     }
     $this->addElements($formElements, 'User Information');
     $this->setChecked('form_send_mail', @$info['send_mail'] == '1' ? 'yes' : 'no');
     $this->addRules($formRules);
     return parent::process('install_general_setup');
 }
Example #10
0
 // sanitize the email
 $email = filter_input(INPUT_GET, "email", FILTER_SANITIZE_EMAIL);
 // grab the mySQL connection
 $pdo = connectToEncryptedMySql("/etc/apache2/ninja-mysql/appsbyninja.ini");
 // handle all RESTful calls to User today
 // get some or all Users
 if ($method === "GET") {
     // set an XSRF cookie on GET requests
     setXsrfCookie("/");
     if (empty($userId) === false) {
         $reply->data = User::getUserByUserId($pdo, $userId);
     } else {
         if (empty($email) === false) {
             $reply->data = User::getUserByEmail($pdo, $email);
         } else {
             $reply->data = User::getAllUsers($pdo);
         }
     }
     // post to a new User
 } else {
     if ($method === "POST") {
         // convert POSTed JSON to an object
         verifyXsrf();
         $requestContent = file_get_contents("php://input");
         $requestObject = json_decode($requestContent);
         if ($requestObject->password !== $requestObject->passwordConfirm) {
             throw new InvalidArgumentException("passwords do not match", 400);
         }
         $salt = bin2hex(openssl_random_pseudo_bytes(32));
         $hash = hash_pbkdf2("sha512", $requestObject->password, $salt, 262144, 128);
         // handle optional fields
Example #11
0
<?php

/* Inclusion de la classe General pour la récupération des données de la base */
require_once "../php/model/User.php";
/* Inclusion du fichier de connexion à la BD */
include_once "../php/controller/connect-bd.php";
$users = new User($bdd);
$data = $users->getAllUsers();
Example #12
0
require_once dirname(dirname(dirname(__FILE__))) . '/modules/User.class.php';
require_once dirname(dirname(dirname(__FILE__))) . '/modules/Dynamo.class.php';
if ($_SESSION['user_type'] == 1 && trim($_GET['del']) == 'true' && trim($_GET['id']) != '') {
    $users_obj = new Dynamo("users");
    $query = "DELETE FROM users WHERE id = " . $_GET['id'];
    $users_obj->customExecuteQuery($query);
}
$userObj = new User();
$listUsers = array();
$companyId = isset($_SESSION['company_id']) ? $_SESSION['company_id'] : 0;
if ($userObj) {
    $userRoleId = isset($_SESSION['user_type']) ? $_SESSION['user_type'] : 0;
    if ($userRoleId == 2) {
        $listUsers = $userObj->getAllUsersPerCompany($companyId, false);
    } else {
        $listUsers = $userObj->getAllUsers(false);
    }
}
?>

<div class="pull-left"><h4>Users</h4></div>
<div class="pull-right"><a href="add_user.html" class="btn btn-warning"><i class="icon-plus icon-white"></i> Add User</a></div>
<div class="clearfix"></div>

<div id="status-message"></div>
<table id="userTable" class="common-table">
<tr>
	<th>Username/Email</th>
	<th>Name</th>
	<th>Company</th>
	<th>User Type</th>
Example #13
0
 } 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);
         if ($fb_id) {
             $facebook_link = "<a href='http://www.facebook.com/profile.php?id={$fb_id}' target='_blank'>{$fb_id}</a>";
Example #14
0
<?php

authentificationRequire();
echo "<section id='listUser'>" . "<h2>Les utilisateurs connectés</h2>";
foreach (User::getAllUsers() as $user) {
    echo "<a href='/Salon/Canal/" . $user->getID() . "'>" . $user->getPseudo() . "</a><br/>";
}
echo "</section>";
?>
Example #15
0
 public function getSendLink($id)
 {
     $sendto = User::findOrFail($id);
     $users = User::getAllUsers();
     $this->layout->content = View::make('users.chat', array('sendto' => $sendto, 'users' => $users));
 }
    ?>
"'>
</td>
</tr>
</table>
<table border='0' cellspacing='0' cellpadding='0'  class='edit view'>
<tr>
<td>
<BR>
<?php 
    echo $mod_strings_users['LBL_REASS_USER_FROM'];
    ?>
<BR>
<select name="fromuser" id='fromuser'>
<?php 
    $all_users = User::getAllUsers();
    echo get_select_options_with_id($all_users, isset($_SESSION['reassignRecords']['fromuser']) ? $_SESSION['reassignRecords']['fromuser'] : '');
    ?>
</select>
<BR>
<BR>
<?php 
    echo $mod_strings_users['LBL_REASS_USER_TO'];
    ?>
<BR>
<select name="touser" id="touser">
<?php 
    if (isset($_SESSION['reassignRecords']['fromuser']) && isset($all_users[$_SESSION['reassignRecords']['fromuser']])) {
        unset($all_users[$_SESSION['reassignRecords']['fromuser']]);
    }
    echo get_select_options_with_id($all_users, isset($_SESSION['reassignRecords']['touser']) ? $_SESSION['reassignRecords']['touser'] : '');
Example #17
0
    $results = array("boolean" => $boolString, "id" => $id['0']['user_id']);
    print_r(json_encode($results));
});
//Adding user info
$app->post('/user/:id', function ($id) {
    global $user, $app;
    $details = json_decode($app->request->getBody(), true);
    //var_dump (json_decode( $app->request->getBody() ) );
    $add = $user->addUserInfo($details);
    $boolString = $add ? 'true' : 'false';
    echo $boolString;
});
//Display All Users:
$app->get('/user/', function () {
    global $user, $app;
    echo json_encode($user->getAllUsers());
    //var_dump ($user->getAllUsers());
});
//Display specific user
$app->get('/user/:id', function ($id) {
    global $user, $app;
    $user = $user->getUser($id);
    echo $user[0]['user_email'];
    //echo ( json_encode($user->getUser($id)) );
});
//Delete User
$app->delete('/user/:id', function ($id) {
    global $user, $app;
    $user->deleteUser($id);
});
//Update User
Example #18
0
    $dbConnection = new PDO($mysql_conn_string, $dbuser, $dbpass);
    //$dbConnection = new PDO('mysql:host=localhost;dbname=appliPHP;charset=utf8', 'root', 'root');
    $dbConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    return $dbConnection;
}
$app = new \Slim\Slim();
//$app->user = new User();
// Routing
$app->get('/', 'welcome');
$app->get('/hello/', 'helloWhore');
// **
//Users
// **
$app->get('/users', function () use($app) {
    $user = new User();
    $user->getAllUsers($app);
});
$app->get('/users/:id', function ($id) use($app) {
    $user = new User();
    $user->getUser($app, $id);
});
$app->post('/users', function () use($app) {
    $user = new User();
    $user->createUser($app);
});
$app->put('/users/:id', function ($id) use($app) {
    $user = new User();
    $user->modifyUser($app, $id);
});
$app->delete('/users/:id', function ($id) use($app) {
    $user = new User();
Example #19
0
<?php

include 'classes/user.php';
$user = new User();
$user->getAllUsers();
Example #20
0
 public function index($name = '')
 {
     $user_info = User::getAllUsers();
     $this->view('home/index', $user_info, []);
 }
Example #21
0
function handleUserAPI($args, $that)
{
    require_once APIROOT . 'controller/user.php';
    if ($that->method === 'POST') {
        if ($that->verb === 'login') {
            $result = $that->file;
            $result = login(isset($result->username) ? $result->username : null, isset($result->password) ? $result->password : null);
            return User::current_user();
        } else {
            if ($that->verb === 'logout') {
                return $session->logout();
            } else {
                if ($that->verb === 'register') {
                    $result = $that->file;
                    $result->username = isset($result->username) ? $result->username : null;
                    $result->password = isset($result->password) ? $result->password : null;
                    $result->email = isset($result->email) ? $result->email : null;
                    $result->first = isset($result->first) ? $result->first : null;
                    $result->last = isset($result->last) ? $result->last : null;
                    $result->gender = isset($result->gender) ? $result->gender : null;
                    $result = register($result);
                    return User::current_user();
                } else {
                    if ($that->verb === 'sendAdminMessage') {
                        $user = User::current_user();
                        $that->file->name = $user->displayableName;
                        $that->file->email = $user->email;
                        return sendAdminMessage($that->file);
                    } else {
                        if ($that->verb === 'resetPassword') {
                            $user = User::getByUsername($that->file->username);
                            if ($user) {
                                return $user->resetPassword();
                            }
                        }
                    }
                }
            }
        }
    }
    if ($that->method === 'GET') {
        if ($that->verb === '') {
            $session = mySession::getInstance();
            $user_id = $session->getVar('user_id');
            if ($user_id) {
                $user = User::getById($user_id);
                unset($user->password);
                return $user;
            } else {
                return false;
            }
        }
        if ($that->verb === 'validate') {
            $id = getRequest('id');
            $value = getRequest('validate');
            return validate($id, $value);
        }
        if ($that->verb === 'isLoggedIn') {
            return User::current_user();
        }
        if ($that->verb === 'getUserInfo' && $session->isLoggedIn() && $session->isAdmin()) {
            $id = intval(array_shift($args));
            if ($id && is_numeric($id)) {
                $user = User::getById($id);
                unset($user->password);
                return $user;
            } else {
                return User::getAllUsers();
            }
        }
        $user = User::current_user();
        unset($user->password);
        return $user;
        // return "that is a test";
    } else {
        return "Only accepts GET AND POSTS requests";
    }
}
Example #22
0
 /**
  * Used to get Arc to build the content of the page or preform API request.
  */
 public static function getContent()
 {
     // Break URL apart and check for API request
     $uri_parts = explode('?', $_SERVER['REQUEST_URI'], 2);
     $uri = $uri_parts[0];
     if (strpos($uri, "/api/v1") === false) {
         // No API, Get regular content
         self::arcGetView();
     } else {
         // Handle API request
         if (!isset($_GET["key"])) {
             self::arcReturnJSON(["error" => "API key required to process request"]);
             \Log::createLog("danger", "API", "API key required to process request");
         } else {
             $key = null;
             $users = \User::getAllUsers();
             foreach ($users as $user) {
                 $apikey = \SystemSetting::getByKey("APIKEY", $user->id);
                 if ($apikey->id != 0 && $apikey->value == $_GET["key"]) {
                     $key = $apikey->value;
                 }
             }
             if (empty($key)) {
                 self::arcReturnJSON(["error" => "Invalid API key"]);
                 \Log::createLog("danger", "API", "Invalid API key");
             } else {
                 $split = explode("/", $uri);
                 if (!isset($split[3]) || !file_exists(self::arcGetPath(true) . "app/modules/{$split[3]}/api")) {
                     self::arcReturnJSON(["error" => "Invalid API request"]);
                     \Log::createLog("danger", "API", "Invalid API request");
                 } elseif (!isset($split[4]) || !file_exists(self::arcGetPath(true) . "app/modules/{$split[3]}/api/{$split[4]}.php")) {
                     self::arcReturnJSON(["error" => "Invalid API method request"]);
                     \Log::createLog("danger", "API", "Invalid API method request");
                 } else {
                     include self::arcGetPath(true) . "app/modules/{$split[3]}/api/{$split[4]}.php";
                     \Log::createLog("success", "API", "OK:: Module: {$split[3]}, Method: {$split[4]}, Key: {$key}");
                 }
             }
         }
     }
 }
Example #23
0
<?php

$usrObj = new User();
if ($usrObj->isLoggedIn() == "") {
    $usrObj->redirect('login.php');
} else {
    $users = $usrObj->getAllUsers();
    $userId = $_SESSION['user_session'];
    $userInfo = $usrObj->getOneUser($userId);
    if ($userInfo["user_position"] != 1) {
        $usrObj->redirect('login.php');
    }
}
$menuObj = new Menu();
$menu = $menuObj->getFullMenu();
$categories = $menuObj->getAllCategories();
$catValue = "";
$catTask = "catAdd";
$catPostIdInput = "";
$productTask = "productAdd";
$productPostIdInput = "";
$productName = "";
$productPrice = "";
$productCatId = 0;
if (isset($_GET["task"])) {
    if ($_GET["task"] == "productEdit") {
        $getProduct = $menuObj->getProduct($_GET["productId"]);
        $productTask = "productEdit";
        $productPostIdInput = '<input type="hidden" name="productId" value="' . $getProduct["id"] . '" />';
        $productName = "value='{$getProduct['name']}'";
        $productPrice = "value='{$getProduct['price']}'";
Example #24
0
 $query = "SELECT table_name FROM {$GLOBALS['CONFIG']['db_prefix']}udf WHERE field_type = '4'";
 $stmt = $pdo->prepare($query);
 $stmt->execute();
 $result = $stmt->fetchAll();
 $num_rows = $stmt->rowCount();
 $i = 0;
 $t_name = array();
 // Set the values for the hidden sub-select fields
 foreach ($result as $data) {
     $explode_v = explode('_', $data['table_name']);
     $t_name[] = $explode_v[2];
     $i++;
 }
 // We need to set a form value for the current user so that
 // they can be pre-selected on the form
 $avail_users = $user_obj->getAllUsers($pdo);
 $users_array = array();
 foreach ($avail_users as $avail_user) {
     if ($avail_user['id'] == $_SESSION['uid']) {
         $avail_user['selected'] = 'selected';
     } else {
         $avail_user['selected'] = '';
     }
     array_push($users_array, $avail_user);
 }
 // We need to set a form value for the current department so that
 // it can be pre-selected on the form
 $avail_departments = Department::getAllDepartments($pdo);
 $departments_array = array();
 foreach ($avail_departments as $avail_department) {
     if ($avail_department['id'] == $current_user_dept) {
Example #25
0
 public function testGetAllUsersAndGetActiveUsers()
 {
     $all_users = User::getAllUsers();
     $this->assertTrue(is_array($all_users));
     $active_users = User::getActiveUsers();
     $this->assertTrue(is_array($active_users));
     $this->assertGreaterThanOrEqual(count($active_users), count($all_users));
 }
<?php

include 'includes/header.php';
$db = new Database();
$pi = new Picture();
$ca = new Category();
$ob = new Obituary();
$us = new User();
$st = new Story();
$stories = $db->select($st->getStoriesAndCategories());
$users = $db->select($us->getAllUsers());
$categories = $db->select($ca->getAllCategories());
$obituaries = $db->select($ob->getAllObituaries());
$images = $db->select($pi->getAllPictures('DESC'));
?>

  <div class="col-md-12">
    <h3>Stories</h3>
    <table class="table table-striped">
      <tr>
        <th>Story ID#</th>
        <th>Title</th>
        <th>Category</th>
        <th>Submitter</th>
        <th>Date</th>
      </tr>    
      <?php 
while ($row = $stories->fetch_assoc()) {
    ?>
        <tr>
          <td><?php 
 public static function adminListUsers()
 {
     $title = "Users";
     $currentQuestion = Question::getCurrentQuestion();
     $remaining_time = Question::getRemainingTime($currentQuestion);
     $leading = Post::getLeadingBant($currentQuestion);
     $get_users = User::getAllUsers();
     return View::make('admin.users')->with(['question' => $currentQuestion, 'remaining_time' => $remaining_time, 'leading' => $leading, 'users' => $get_users, 'title' => $title]);
 }
Example #28
0
<?php

if (!isset($_SESSION)) {
    session_start();
}
define('__ROOT__', dirname(dirname(__FILE__)));
define('__BASENAME__', basename(__ROOT__));
require_once __ROOT__ . '/modules/User.class.php';
$userObj = new User();
$userObj->getAllUsers();
Example #29
0
$myUser = false;
$conf = new Configuration();
$conf->getAll();
//Inclusion des plugins
Plugin::includeAll($conf->get("DEFAULT_THEME"));
$userManager = new User();
if (isset($_SESSION['currentUser'])) {
    $myUser = unserialize($_SESSION['currentUser']);
} else {
    if (AUTO_LOGIN != '') {
        $myUser = $userManager->exist(AUTO_LOGIN, '', true);
        $_SESSION['currentUser'] = serialize($myUser);
    }
}
if (!$myUser && isset($_COOKIE[$conf->get('COOKIE_NAME')])) {
    $users = User::getAllUsers();
    foreach ($users as $user) {
        if ($user->getCookie() == $_COOKIE[$conf->get('COOKIE_NAME')]) {
            $myUser = $user;
            $myUser->loadRight();
        }
    }
}
//Instanciation du template
$tpl = new RainTPL();
//Definition des dossiers de template
raintpl::configure("base_url", null);
raintpl::configure("tpl_dir", './templates/' . $conf->get('DEFAULT_THEME') . '/');
raintpl::configure("cache_dir", "./cache/tmp/");
$view = '';
$rank = new Rank();
 private function procViewUsers()
 {
     echo "<h2>View All Users</h2>";
     echo "<p>Below is a list of all library users registered</p>";
     $users = new User();
     $result = $users->getAllUsers();
     echo "<p><table class=\"search\">\r\n                    <tr class=\"highLightRowCol\">\r\n                        <td>#</td>\r\n                        <td>Name</td>\r\n                        <td>Username</td>\r\n                        <td>e-mail</td>\r\n                        <td>Type</td>\r\n                        <td>Card Number</td>\r\n                    </tr>";
     $count = 1;
     while ($row = mysql_fetch_array($result)) {
         $lastname = $row['LastName'];
         $firstname = $row['FirstName'];
         $username = $row['UserName'];
         $email = $row['Email'];
         $type = $row['UserType'];
         $cardNo = $row['CardNo'];
         echo "<tr>\r\n        \t\t\t<td>{$count}</td>\r\n        \t\t\t<td>{$lastname}, {$firstname}</td>\r\n        \t\t\t<td>{$username}</td>\r\n        \t\t\t<td>{$email}</td>\r\n        \t\t\t<td>{$type}</td>\r\n        \t\t\t<td>{$cardNo}</td>\r\n        \t\t</tr>";
         $count++;
     }
     echo "</table>";
 }