A tumblelog CMS built on AJAX, PHP and MySQL.

admin.php 5.4KB

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