Advertisement
Guest User

Untitled

a guest
Jun 18th, 2022
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.09 KB | None | 0 0
  1. <?php
  2. /*
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 3.5.0.0
  8. * @ Author : DeZender
  9. * @ Release on : 22.06.2018
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. include_once 'include/config.php';
  15. include_once 'do_auth.php';
  16. include_once 'functions.php';
  17.  
  18. if (isset($_GET['getadmins'])) {
  19. $numResults = prepParamPlain($_GET['results'], 15);
  20. $startIndex = prepParamPlain($_GET['startIndex'], 0);
  21. $sortdir = prepParamSanitize($_GET['sortdir'], array('yui-dt-asc', 'yui-dt-desc'), 'yui-dt-asc');
  22. $sortby = ($sortdir == 'yui-dt-asc' ? 'ASC' : 'DESC');
  23. $sortkey = prepParamSanitize($_GET['sortkey'], array('name', 'auth', 'role', 'description', 'lastlogin', 'lastloginip'), 'name');
  24. $filteradmins = prepParamPlain($_GET['filteradmins']);
  25. $filterroles = prepParamPlain($_GET['filterroles']);
  26.  
  27. switch ($sortkey) {
  28. case 'name':
  29. case 'description':
  30. $sortby = 'LOWER(admins.description) ' . $sortby;
  31.  
  32. break;
  33.  
  34. case 'role':
  35. $sortby = 'LOWER(roles.role_name) ' . $sortby;
  36.  
  37. break;
  38.  
  39. case 'auth':
  40. $sortby = 'LOWER(admins.auth) ' . $sortby;
  41.  
  42. break;
  43.  
  44. case 'lastlogin':
  45. $sortby = 'admins.lastlogin ' . $sortby;
  46.  
  47. break;
  48.  
  49. case 'lastloginip':
  50. $sortby = 'admins.lastip ' . $sortby;
  51.  
  52. break;
  53.  
  54. default:
  55. $sortby = 'LOWER(admins.username) ' . $sortby;
  56.  
  57. break;
  58. }
  59. $where = 'WHERE admins.readonly = FALSE ';
  60.  
  61. if (!empty($filteradmins)) {
  62. $where .= 'AND admins.username ILIKE :filteradmins ';
  63. $filteradmins = '%' . $filteradmins . '%';
  64. }
  65.  
  66. if (!empty($filterroles)) {
  67. $where .= 'AND roles.role_name ILIKE :filterroles ';
  68. $filterroles = '%' . $filterroles . '%';
  69. }
  70.  
  71. $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;
  72. $stmt = $db->prepare($q);
  73.  
  74. if (!empty($filteradmins)) {
  75. $stmt->bindParam(':filteradmins', $filteradmins);
  76. }
  77.  
  78. if (!empty($filterroles)) {
  79. $stmt->bindParam(':filterroles', $filterroles);
  80. }
  81.  
  82. $stmt->execute();
  83. $totalRecords = $stmt->fetchColumn();
  84. $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";
  85. $stmt = $db->prepare($q);
  86. $stmt->bindParam(':numResults', $numResults);
  87. $stmt->bindParam(':startIndex', $startIndex);
  88.  
  89. if (!empty($filteradmins)) {
  90. $stmt->bindParam(':filteradmins', $filteradmins);
  91. }
  92.  
  93. if (!empty($filterroles)) {
  94. $stmt->bindParam(':filterroles', $filterroles);
  95. }
  96.  
  97. $stmt->execute();
  98. $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
  99. $records = array();
  100.  
  101. foreach ($rows as $row) {
  102. $roleName = roleidtoname($row['role_id']);
  103. $lastlogin = (empty($row['lastlogin']) ? _('Never') : $row['lastlogin']);
  104. $lastloginip = (empty($row['lastip']) ? '-' : $row['lastip']);
  105. $filter = _getfilterdescription($row['role_id'], $row['filter_type'], $row['filter_operator'], $row['filter']);
  106. $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']));
  107. }
  108. array_walk_recursive($records, 'filterOutput');
  109. $data = array();
  110. $data['records'] = $records;
  111. $data['totalRecords'] = $totalRecords;
  112. $data['sortdir'] = $sortdir;
  113. $data['sortkey'] = $sortkey;
  114. echo json_encode($data);
  115.  
  116. exit();
  117. } else {
  118. if (isset($_GET['findPolicies'])) {
  119. $records = array();
  120. .....................................................................
  121. ............................................
  122. .............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement