Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- *
- * @ This file is created by http://DeZender.Net
- * @ deZender (PHP5 Decoder for ionCube Encoder)
- *
- * @ Version : 3.5.0.0
- * @ Author : DeZender
- * @ Release on : 22.06.2018
- * @ Official site : http://DeZender.Net
- *
- */
- include_once 'include/config.php';
- include_once 'do_auth.php';
- include_once 'functions.php';
- if (isset($_GET['getadmins'])) {
- $numResults = prepParamPlain($_GET['results'], 15);
- $startIndex = prepParamPlain($_GET['startIndex'], 0);
- $sortdir = prepParamSanitize($_GET['sortdir'], array('yui-dt-asc', 'yui-dt-desc'), 'yui-dt-asc');
- $sortby = ($sortdir == 'yui-dt-asc' ? 'ASC' : 'DESC');
- $sortkey = prepParamSanitize($_GET['sortkey'], array('name', 'auth', 'role', 'description', 'lastlogin', 'lastloginip'), 'name');
- $filteradmins = prepParamPlain($_GET['filteradmins']);
- $filterroles = prepParamPlain($_GET['filterroles']);
- switch ($sortkey) {
- case 'name':
- case 'description':
- $sortby = 'LOWER(admins.description) ' . $sortby;
- break;
- case 'role':
- $sortby = 'LOWER(roles.role_name) ' . $sortby;
- break;
- case 'auth':
- $sortby = 'LOWER(admins.auth) ' . $sortby;
- break;
- case 'lastlogin':
- $sortby = 'admins.lastlogin ' . $sortby;
- break;
- case 'lastloginip':
- $sortby = 'admins.lastip ' . $sortby;
- break;
- default:
- $sortby = 'LOWER(admins.username) ' . $sortby;
- break;
- }
- $where = 'WHERE admins.readonly = FALSE ';
- if (!empty($filteradmins)) {
- $where .= 'AND admins.username ILIKE :filteradmins ';
- $filteradmins = '%' . $filteradmins . '%';
- }
- if (!empty($filterroles)) {
- $where .= 'AND roles.role_name ILIKE :filterroles ';
- $filterroles = '%' . $filterroles . '%';
- }
- $q = "SELECT count(*) FROM admins\n\t\t\tLEFT JOIN user_role ON admins.id = user_role.user_id\n\t\t\tLEFT JOIN roles ON user_role.role_id = roles.role_id " . $where;
- $stmt = $db->prepare($q);
- if (!empty($filteradmins)) {
- $stmt->bindParam(':filteradmins', $filteradmins);
- }
- if (!empty($filterroles)) {
- $stmt->bindParam(':filterroles', $filterroles);
- }
- $stmt->execute();
- $totalRecords = $stmt->fetchColumn();
- $q = "SELECT admins.id, admins.username, admins.auth, admins.description,\n admins.readonly, admins.lastlogin, admins.lastip,\n user_role.filter_type, user_role.filter_operator, user_role.filter,\n roles.role_id FROM admins\n LEFT JOIN user_role ON admins.id = user_role.user_id\n LEFT JOIN roles ON user_role.role_id = roles.role_id\n " . $where . ' ORDER BY ' . $sortby . "\n LIMIT :numResults OFFSET :startIndex";
- $stmt = $db->prepare($q);
- $stmt->bindParam(':numResults', $numResults);
- $stmt->bindParam(':startIndex', $startIndex);
- if (!empty($filteradmins)) {
- $stmt->bindParam(':filteradmins', $filteradmins);
- }
- if (!empty($filterroles)) {
- $stmt->bindParam(':filterroles', $filterroles);
- }
- $stmt->execute();
- $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
- $records = array();
- foreach ($rows as $row) {
- $roleName = roleidtoname($row['role_id']);
- $lastlogin = (empty($row['lastlogin']) ? _('Never') : $row['lastlogin']);
- $lastloginip = (empty($row['lastip']) ? '-' : $row['lastip']);
- $filter = _getfilterdescription($row['role_id'], $row['filter_type'], $row['filter_operator'], $row['filter']);
- $records[] = array('id' => $row['id'], 'name' => $row['username'], 'filter' => $filter, 'description' => $row['description'], 'auth' => $row['auth'], 'role' => $roleName, 'lastlogin' => $lastlogin, 'lastloginip' => $lastloginip, 'readonly' => $row['readonly'], 'options' => array('id' => $row['id'], 'readonly' => $row['readonly']));
- }
- array_walk_recursive($records, 'filterOutput');
- $data = array();
- $data['records'] = $records;
- $data['totalRecords'] = $totalRecords;
- $data['sortdir'] = $sortdir;
- $data['sortkey'] = $sortkey;
- echo json_encode($data);
- exit();
- } else {
- if (isset($_GET['findPolicies'])) {
- $records = array();
- .....................................................................
- ............................................
- .............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement