A tumblelog CMS built on AJAX, PHP and MySQL.

admin.php 5.0KB

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