show_users.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <script type="text/javascript" src="js/modules/show_users.js"></script>
  2. <style type="text/css">
  3. tr.hide{
  4. display: none;
  5. }
  6. table.userListTable{
  7. border-collapse: collapse;
  8. border: 0px;
  9. }
  10. table.userListTable td{
  11. padding-left: 5px;
  12. }
  13. tr.subusersShowHide{cursor: pointer;}
  14. th.subuserColumn{
  15. width: 140px;
  16. }
  17. td.actions{
  18. cursor: default;
  19. }
  20. </style>
  21. <?php
  22. /*
  23. *
  24. * OGP - Open Game Panel
  25. * Copyright (C) Copyright (C) 2008 - 2013 The OGP Development Team
  26. *
  27. * http://www.opengamepanel.org/
  28. *
  29. * This program is free software; you can redistribute it and/or
  30. * modify it under the terms of the GNU General Public License
  31. * as published by the Free Software Foundation; either version 2
  32. * of the License, or any later version.
  33. *
  34. * This program is distributed in the hope that it will be useful,
  35. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  36. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  37. * GNU General Public License for more details.
  38. *
  39. * You should have received a copy of the GNU General Public License
  40. * along with this program; if not, write to the Free Software
  41. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  42. *
  43. */
  44. function exec_ogp_module() {
  45. global $db, $loggedInUserInfo;
  46. $page_user = isset($_GET['page']) ? $_GET['page'] : 1;
  47. $limit_user = isset($_GET['limit']) ? $_GET['limit'] : 10;
  48. if(hasValue($loggedInUserInfo) && is_array($loggedInUserInfo) && $loggedInUserInfo["users_page_limit"]){
  49. $limit_user = $loggedInUserInfo["users_page_limit"];
  50. }
  51. echo '<h2>'.get_lang('users')."</h2>";
  52. echo "<p><a href='?m=user_admin&amp;p=add'>".get_lang('add_new_user')."</a></p>";
  53. echo '<table class="userListTable center" style="width: 100%;">';
  54. echo '<tr><th>'.get_lang('actions')."</th><th>".get_lang('username')."</th>";
  55. echo "<th>".get_lang('user_role')."</th>";
  56. echo "<th>".get_lang('email_address')."</th>";
  57. echo "<th>".get_lang('expires')."</th>";
  58. echo "<th class='subuserColumn'>".get_lang('subusers')."</th></tr>";
  59. $result = $db->getUserList_limit($page_user,$limit_user);
  60. $i = 0;
  61. foreach ( $result as $row )
  62. {
  63. // Show user's parent
  64. $ownedBy = "";
  65. if(!is_null($row['users_parent'])){
  66. $ownedBy = $row['users_parent'];
  67. }
  68. $user_expires = read_expire($row['user_expires']);
  69. print "<tr class='tr".($i++%2)." ";
  70. print $row['users_role'] . " ";
  71. if(!empty($ownedBy)){
  72. print "hide";
  73. }else{
  74. print "subusersShowHide";
  75. }
  76. print "' uid='" . $row['user_id'] . "'";
  77. if(!empty($ownedBy)){
  78. print "ownedby='" . $ownedBy . "'";
  79. }
  80. print ">";
  81. print "<td class='actions'><a href='?m=user_games&amp;p=assign&amp;user_id=$row[user_id]'>[".
  82. get_lang('assign_homes')."]</a><br />
  83. <a href='?m=user_admin&amp;p=del&amp;user_id=$row[user_id]'>[".get_lang('delete')."]</a><br />
  84. <a href='?m=user_admin&amp;p=edit_user&amp;user_id=$row[user_id]'>[".get_lang('edit_profile')."]</a></td>
  85. <td>".htmlentities($row['users_login'])."</td><td>".htmlentities($row['users_role'])."</td>
  86. <td>".htmlentities($row['users_email'])."</td>
  87. <td>$user_expires</td>";
  88. if(!empty($ownedBy)){
  89. print "<td></td>";
  90. }else{
  91. print "<td class='subUserShowHideTextTd expand' showtext='" . get_lang('show_subusers') . "' hidetext='" . get_lang('hide_subusers') . "'>" . get_lang('show_subusers') . " &darr;</td>";
  92. }
  93. print "</tr>";
  94. }
  95. echo '</table><br>';
  96. $count_users = $db->get_user_count();
  97. if($count_users > $limit_user)
  98. {
  99. $total_pages = $count_users[0]['total'] / $limit_user;
  100. $pagination = "";
  101. for($page=1; $page <= $total_pages+1; $page++)
  102. {
  103. if($page == $page_user){
  104. $pagination .= " <b>$page</b>,";
  105. }else{
  106. if(isset($limit_user)){
  107. $limits = $limit_user;
  108. $pagination .= "<a href='?m=user_admin&page=$page&limit=$limits'>$page</a>,";
  109. }else{
  110. $pagination .= " <a href='?m=user_admin&page=$page' >$page</a>,";
  111. }
  112. }
  113. }
  114. echo rtrim($pagination, ",");
  115. }
  116. }
  117. ?>