A tumblelog CMS built on AJAX, PHP and MySQL.

admin.php 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <?
  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. <?
  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="<?=$conf->urlGelato;?>/images/favicon.ico" />
  22. <script language="javascript" type="text/javascript" src="<?=$conf->urlGelato;?>/admin/scripts/mootools.js"></script>
  23. <script language="javascript" type="text/javascript" src="<?=$conf->urlGelato;?>/admin/scripts/sortable.js"></script>
  24. <style type="text/css" media="screen">
  25. @import "<?=$conf->urlGelato;?>/admin/css/style.css";
  26. </style>
  27. </head>
  28. <body>
  29. <div id="div-process" style="display:none;">Processing request...</div>
  30. <div id="cont">
  31. <div id="head">
  32. <h1><a href="<?=$conf->urlGelato;?>/admin/index.php" title="gelato :: home">gelato cms</a></h1>
  33. <ul id="nav">
  34. <li><a href="<?=$conf->urlGelato;?>/" title="Take me to the tumblelog">View Tumblelog</a></li>
  35. <li><a href="close.php" title="Log off" onclick="return exit('div-process','<?=$conf->urlGelato;?>/admin/ajax.php?action=close');">Log out</a></li>
  36. </ul>
  37. </div>
  38. <div id="main">
  39. <div class="box">
  40. <ul class="menu manage">
  41. <h3>Manage</h3>
  42. <li><a href="#">Settings</a></li>
  43. <li><a href="<?=$conf->urlGelato;?>/admin/index.php">Posts</a></li>
  44. <li><a href="<?=$conf->urlGelato;?>/admin/user.php">Add user</a></li>
  45. <li class="selected"><a href="#">Users</a></li>
  46. </ul>
  47. <?
  48. if (isset($_GET["added"])) {
  49. if ($_GET["added"]=="true") {
  50. echo "<div class=\"exito\">The user has been added successfully.</div>";
  51. }
  52. }
  53. if (isset($_GET["delete"])) {
  54. if ($_GET["delete"]=="true") {
  55. echo "<div class=\"exito\">The user has been eliminated successfully.</div>";
  56. }
  57. }
  58. if (isset($_GET["modified"])) {
  59. if ($_GET["modified"]=="true") {
  60. echo "<div class=\"exito\">The user has been modified successfully.</div>";
  61. }
  62. }
  63. if (isset($_GET["error"])) {
  64. if ($_GET["error"]==1) {
  65. echo "<div class=\"error\">The username is not available.</div>";
  66. } elseif ($_GET["error"]==2) {
  67. echo "<div class=\"error\"><strong>Error on the database server: </strong>".$_GET["des"]."</div>";
  68. }
  69. }
  70. ?>
  71. <div class="tabla">
  72. <table class="sortable" id="admin-table">
  73. <thead>
  74. <tr>
  75. <th scope="col">Login</th>
  76. <th scope="col">Name</th>
  77. <th colspan="2" scope="col" class="unsortable">Actions</th>
  78. </tr>
  79. </thead>
  80. <tbody>
  81. <?
  82. $odd=false;
  83. $rs = $user->getUsers();
  84. if ($user->contarRegistros()>0) {
  85. while($register = mysql_fetch_array($rs)) {
  86. ?>
  87. <tr <? if ($odd) { echo 'class="odd"'; } $odd=!$odd; ?>>
  88. <td>
  89. <? echo $register["login"]."\n"; ?>
  90. </td>
  91. <td>
  92. <? echo $register["name"]."\n"; ?>
  93. </td>
  94. <td>
  95. <a href="user.php?edit=<?=$register["id_user"]; ?>">Edit</a>
  96. </td>
  97. <td>
  98. <a href="user.php?delete=<?=$register["id_user"]; ?>">Delete</a>
  99. </td>
  100. </tr>
  101. <?
  102. }
  103. }
  104. else {
  105. ?>
  106. <tr>
  107. <td colspan="4"><div class="exito">No users available.</div></td>
  108. </tr>
  109. <?
  110. }
  111. ?>
  112. </tbody>
  113. </table>
  114. </div>
  115. <div class="footer-box">&nbsp;</div>
  116. </div>
  117. </div>
  118. <div id="foot">
  119. <a href="http://www.gelatocms.com/" title="gelato CMS" target="_blank">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
  120. </div>
  121. </div>
  122. </body>
  123. </html>
  124. <?
  125. } else {
  126. header("Location: ".$conf->urlGelato."/login.php");
  127. }
  128. ?>