A tumblelog CMS built on AJAX, PHP and MySQL.

admin.php 4.8KB

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