A tumblelog CMS built on AJAX, PHP and MySQL.

admin.php 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <?php
  2. if (!defined('entry')) {
  3. define('entry', true);
  4. }
  5. /* ===========================
  6. Sorbet CMS - A PHP based tumblelog CMS forked from Gelato CMS
  7. Sorbet CMS is a free software licensed under the GPL 3.0
  8. =========================== */
  9. require_once '../entry.php';
  10. global $user, $conf, $tumble;
  11. if ($user->isAdmin()) {
  12. ?>
  13. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  14. <html xmlns="http://www.w3.org/1999/xhtml">
  15. <head>
  16. <title>sorbet :: <?php echo __("admin users")?></title>
  17. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  18. <?php $util_class = new util(); ?>
  19. <meta name="generator" content="sorbet cms <?php echo $util_class->version(); ?>" />
  20. <link rel="shortcut icon" href="<?php echo $conf->urlSorbet; ?>/images/favicon.ico" />
  21. <script language="javascript" type="text/javascript" src="<?php echo $conf->urlSorbet; ?>/admin/scripts/jquery.js"></script>
  22. <script language="javascript" type="text/javascript" src="<?php echo $conf->urlSorbet; ?>/admin/scripts/tools.js"></script>
  23. <script language="javascript" type="text/javascript" src="<?php echo $conf->urlSorbet; ?>/admin/scripts/jquery.tablesorter.min.js"></script>
  24. <script type="text/javascript">
  25. $(document).ready(function(){
  26. $("#admin-table").tablesorter({
  27. headers: {
  28. 2: {sorter: false},
  29. 3: {sorter: false}
  30. }
  31. });
  32. $("#divMessages").fadeOut(5000,function(){
  33. $("#divMessages").css({display:"none"});
  34. });
  35. });
  36. </script>
  37. <style type="text/css" media="screen">
  38. @import "<?php echo $conf->urlSorbet; ?>/admin/css/style.css";
  39. </style>
  40. </head>
  41. <body>
  42. <div id="div-process" style="display:none;"><?php echo __("Processing request&hellip;")?></div>
  43. <div id="cont">
  44. <div id="head">
  45. <h1><a href="<?php echo $conf->urlSorbet; ?>/admin/index.php" title="sorbet :: <?php echo __("home")?>">sorbet cms</a></h1>
  46. <ul id="nav">
  47. <li><a href="<?php echo $conf->urlSorbet; ?>/" title="Take me to the tumblelog"><?php echo __("View Tumblelog")?></a></li>
  48. <li><a href="close.php" title="Log off" onclick="return exit('div-process','<?php echo $conf->urlSorbet; ?>/admin/ajax.php?action=close');"><?php echo __("Log out")?></a></li>
  49. </ul>
  50. </div>
  51. <div id="main">
  52. <div class="box">
  53. <ul class="menu manage">
  54. <h3>Manage</h3>
  55. <li><a href="<?php echo $conf->urlSorbet; ?>/admin/plugins.php"><?php echo __("Plugins")?></a></li>
  56. <li><a href="<?php echo $conf->urlSorbet; ?>/admin/settings.php"><?php echo __("Settings")?></a></li>
  57. <li><a href="<?php echo $conf->urlSorbet; ?>/admin/index.php"><?php echo __("Posts")?></a></li>
  58. <li><a href="<?php echo $conf->urlSorbet; ?>/admin/user.php"><?php echo __("Add user")?></a></li>
  59. <li class="selected"><a><?php echo __("Users")?></a></li>
  60. </ul>
  61. <p>&nbsp;</p>
  62. <?php
  63. if (isset($_GET["added"])) {
  64. if ($_GET["added"]=="true") {
  65. echo "<div class=\"exito\" id=\"divMessages\">".__("The user has been added successfully.")."</div>";
  66. }
  67. }
  68. if (isset($_GET["delete"])) {
  69. if ($_GET["delete"]=="true") {
  70. echo "<div class=\"exito\" id=\"divMessages\">".__("The user has been eliminated successfully.")."</div>";
  71. }
  72. }
  73. if (isset($_GET["modified"])) {
  74. if ($_GET["modified"]=="true") {
  75. echo "<div class=\"exito\" id=\"divMessages\">".__("The user has been modified successfully.")."</div>";
  76. }
  77. }
  78. if (isset($_GET["error"])) {
  79. if ($_GET["error"]==1) {
  80. echo "<div class=\"error\" id=\"divMessages\">".__("The username is not available.")."</div>";
  81. } elseif ($_GET["error"]==2) {
  82. echo "<div class=\"error\" id=\"divMessages\"><strong>".__("Error on the database server:.")." </strong>".$_GET["des"]."</div>";
  83. }
  84. } ?>
  85. <div class="tabla">
  86. <table border="0" cellpadding="0" cellspacing="0" id="admin-table">
  87. <thead>
  88. <tr>
  89. <th scope="col"><?php echo __("Login")?></th>
  90. <th scope="col"><?php echo __("Name")?></th>
  91. <th scope="col"><?php echo __("Actions")?></th>
  92. <th scope="col"></th>
  93. </tr>
  94. </thead>
  95. <tbody>
  96. <?php
  97. $odd=false;
  98. $rs = $user->getUsers();
  99. if ($db->contarRegistros()>0) {
  100. while ($register = $rs->fetch()) {
  101. ?>
  102. <tr <?php if ($odd) {
  103. echo 'class="odd"';
  104. }
  105. $odd=!$odd; ?>>
  106. <td><?php echo $register["login"]."\n"; ?></td>
  107. <td><?php echo $register["name"]."\n"; ?></td>
  108. <td><a href="user.php?edit=<?php echo $register["id_user"]; ?>"><?php echo __("Edit")?></a></td>
  109. <td><?php if ($_SESSION["user_id"] != $register["id_user"]) {
  110. ?><a href="user.php?delete=<?php echo $register["id_user"]; ?>"><?php echo __("Delete")?></a><?php
  111. } ?>&nbsp;</td>
  112. </tr>
  113. <?php
  114. }
  115. } else {
  116. ?>
  117. <tr>
  118. <td colspan="4"><div class="exito"><?php echo __("No users available.")?></div></td>
  119. </tr>
  120. <?php
  121. } ?>
  122. </tbody>
  123. </table>
  124. </div>
  125. <div class="footer-box">&nbsp;</div>
  126. </div>
  127. </div>
  128. <div id="foot">
  129. Sorbet CMS :: PHP Tumblelog Content Management System.
  130. </div>
  131. </div>
  132. </body>
  133. </html>
  134. <?php
  135. } else {
  136. header("Location: ".$conf->urlSorbet."/login.php");
  137. }
  138. ?>