function _showUsers() { global $Logs; $users = admin_getAllUsers(); $roles = admin_getAllRoles(); ?> <h3>Users</h3> <table border="1"> <thead> <tr> <td>Name</td> <td>Surname</td> <td>Login</td> <td>Role</td> <td>Active</td> <td> </td> </tr> </thead> <?php foreach ($users as $user) { ?> <tr> <td><?php print $user['name']; ?> </td> <td><?php print $user['surname']; ?> </td> <td><?php print $user['login']; ?> </td> <td><?php $parent = arraySearch($user['role'], $roles, 'id'); ?> <?php if ($parent !== false) { print $roles[$parent]['name']; } ?> </td> <td><?php print (int) $user['active'] ? 'Yes' : 'No'; ?> </td> <td> <a href="<?php getUrl('admin'); ?> ?action=edituser&id=<?php print $user['id']; ?> ">edit</a> </td> </tr> <?php } ?> </table> <?php }
$aVals[] = array('active', 0, false); } } if (!$DB->update('core_users', $aVals, array('id', '=', $_POST['userid']))) { throw new cException("Some error during update operation!"); } $aAlerts[] = "User was updated."; } catch (cException $e) { $msg = $e->getDbMessageError(__METHOD__ . '(line:' . __LINE__ . ')'); $aErrors[] = $msg; cLogsDb::addFileLog($msg); } } } /// end of POST data sent /// $users = admin_getAllUsers(); if (($id = arraySearch($_GET['id'], $users, 'id')) !== false) { $User = $users[$id]; } else { header("Location: " . getUrl() . "admin"); } $roles = admin_getAllRoles(); $Logs->addLog($users, "admin_getAllUsers"); ########################################################################################### ##################################### code to print ####################################### foreach ($aErrors as $error) { print "<div class='error'>{$error}</div>"; } foreach ($aAlerts as $alert) { print "<div class='alert'>{$alert}</div>"; }