A tumblelog CMS built on AJAX, PHP and MySQL.

admin.php 5.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <?php
  2. if (!defined('entry')) {
  3. define('entry', true);
  4. }
  5. /* ===========================
  6. gelato CMS - A PHP based tumblelog CMS
  7. development version
  8. http://www.gelatocms.com/
  9. gelato CMS is a free software licensed under the GPL 2.0
  10. Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
  11. =========================== */
  12. require_once('../entry.php');
  13. global $user, $conf, $tumble;
  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 :: <?php echo __("admin users")?></title>
  20. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  21. <?php $util_class = new util(); ?>
  22. <meta name="generator" content="gelato cms <?php echo $util_class->version(); ?>" />
  23. <link rel="shortcut icon" href="<?php echo $conf->urlGelato; ?>/images/favicon.ico" />
  24. <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato; ?>/admin/scripts/jquery.js"></script>
  25. <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato; ?>/admin/scripts/tools.js"></script>
  26. <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato; ?>/admin/scripts/jquery.tablesorter.min.js"></script>
  27. <script type="text/javascript">
  28. $(document).ready(function(){
  29. $("#admin-table").tablesorter({
  30. headers: {
  31. 2: {sorter: false},
  32. 3: {sorter: false}
  33. }
  34. });
  35. $("#divMessages").fadeOut(5000,function(){
  36. $("#divMessages").css({display:"none"});
  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&hellip;")?></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/plugins.php"><?php echo __("Plugins")?></a></li>
  59. <li><a href="<?php echo $conf->urlGelato; ?>/admin/settings.php"><?php echo __("Settings")?></a></li>
  60. <li><a href="<?php echo $conf->urlGelato; ?>/admin/index.php"><?php echo __("Posts")?></a></li>
  61. <li><a href="<?php echo $conf->urlGelato; ?>/admin/user.php"><?php echo __("Add user")?></a></li>
  62. <li class="selected"><a><?php echo __("Users")?></a></li>
  63. </ul>
  64. <p>&nbsp;</p>
  65. <?php
  66. if (isset($_GET["added"])) {
  67. if ($_GET["added"]=="true") {
  68. echo "<div class=\"exito\" id=\"divMessages\">".__("The user has been added successfully.")."</div>";
  69. }
  70. }
  71. if (isset($_GET["delete"])) {
  72. if ($_GET["delete"]=="true") {
  73. echo "<div class=\"exito\" id=\"divMessages\">".__("The user has been eliminated successfully.")."</div>";
  74. }
  75. }
  76. if (isset($_GET["modified"])) {
  77. if ($_GET["modified"]=="true") {
  78. echo "<div class=\"exito\" id=\"divMessages\">".__("The user has been modified successfully.")."</div>";
  79. }
  80. }
  81. if (isset($_GET["error"])) {
  82. if ($_GET["error"]==1) {
  83. echo "<div class=\"error\" id=\"divMessages\">".__("The username is not available.")."</div>";
  84. } elseif ($_GET["error"]==2) {
  85. echo "<div class=\"error\" id=\"divMessages\"><strong>".__("Error on the database server:.")." </strong>".$_GET["des"]."</div>";
  86. }
  87. } ?>
  88. <div class="tabla">
  89. <table border="0" cellpadding="0" cellspacing="0" 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 scope="col"><?php echo __("Actions")?></th>
  95. <th scope="col"></th>
  96. </tr>
  97. </thead>
  98. <tbody>
  99. <?php
  100. $odd=false;
  101. $rs = $user->getUsers();
  102. if ($db->contarRegistros()>0) {
  103. while ($register = mysql_fetch_array($rs)) {
  104. ?>
  105. <tr <?php if ($odd) {
  106. echo 'class="odd"';
  107. }
  108. $odd=!$odd; ?>>
  109. <td><?php echo $register["login"]."\n"; ?></td>
  110. <td><?php echo $register["name"]."\n"; ?></td>
  111. <td><a href="user.php?edit=<?php echo $register["id_user"]; ?>"><?php echo __("Edit")?></a></td>
  112. <td><?php if ($_SESSION["user_id"] != $register["id_user"]) {
  113. ?><a href="user.php?delete=<?php echo $register["id_user"]; ?>"><?php echo __("Delete")?></a><?php
  114. } ?>&nbsp;</td>
  115. </tr>
  116. <?php
  117. }
  118. } else {
  119. ?>
  120. <tr>
  121. <td colspan="4"><div class="exito"><?php echo __("No users available.")?></div></td>
  122. </tr>
  123. <?php
  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. ?>