A tumblelog CMS built on AJAX, PHP and MySQL.

admin.php 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <?php
  2. if(!defined('entry')) define('entry',true);
  3. /* ===========================
  4. gelato CMS - A PHP based tumblelog CMS
  5. development version
  6. http://www.gelatocms.com/
  7. gelato CMS is a free software licensed under the GPL 2.0
  8. Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
  9. =========================== */
  10. include("../classes/user.class.php");
  11. include("../classes/functions.php");
  12. require_once("../classes/configuration.class.php");
  13. require_once('../entry.php');
  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. <meta name="generator" content="gelato cms <?php echo version();?>" />
  22. <link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
  23. <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/mootools.js"></script>
  24. <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/sortable.js"></script>
  25. <script type="text/javascript">
  26. <!--
  27. window.onload = function() {
  28. contenedor = new Fx.Style('divMessages', 'opacity', {duration: 5000, onComplete:
  29. function() {
  30. document.getElementById('divMessages').style.display="none";
  31. }
  32. });
  33. contenedor.custom(1,0);
  34. }
  35. -->
  36. </script>
  37. <style type="text/css" media="screen">
  38. @import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
  39. </style>
  40. </head>
  41. <body>
  42. <div id="div-process" style="display:none;"><?php echo __("Processing request...")?></div>
  43. <div id="cont">
  44. <div id="head">
  45. <h1><a href="<?php echo $conf->urlGelato;?>/admin/index.php" title="gelato :: <?php echo __("home")?>">gelato cms</a></h1>
  46. <ul id="nav">
  47. <li><a href="<?php echo $conf->urlGelato;?>/" title="Take me to the tumblelog"><?php echo __("View Tumblelog")?></a></li>
  48. <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>
  49. </ul>
  50. </div>
  51. <div id="main">
  52. <div class="box">
  53. <ul class="menu manage">
  54. <h3>Manage</h3>
  55. <li><a href="<?php echo $conf->urlGelato;?>/admin/settings.php"><?php echo __("Settings")?></a></li>
  56. <li><a href="<?php echo $conf->urlGelato;?>/admin/index.php"><?php echo __("Posts")?></a></li>
  57. <li><a href="<?php echo $conf->urlGelato;?>/admin/user.php"><?php echo __("Add user")?></a></li>
  58. <li class="selected"><a><?php echo __("Users")?></a></li>
  59. </ul>
  60. <p>&nbsp;</p>
  61. <?php
  62. if (isset($_GET["added"])) {
  63. if ($_GET["added"]=="true") {
  64. echo "<div class=\"exito\" id=\"divMessages\">".__("The user has been added successfully.")."</div>";
  65. }
  66. }
  67. if (isset($_GET["delete"])) {
  68. if ($_GET["delete"]=="true") {
  69. echo "<div class=\"exito\" id=\"divMessages\">".__("The user has been eliminated successfully.")."</div>";
  70. }
  71. }
  72. if (isset($_GET["modified"])) {
  73. if ($_GET["modified"]=="true") {
  74. echo "<div class=\"exito\" id=\"divMessages\">".__("The user has been modified successfully.")."</div>";
  75. }
  76. }
  77. if (isset($_GET["error"])) {
  78. if ($_GET["error"]==1) {
  79. echo "<div class=\"error\" id=\"divMessages\">".__("The username is not available.")."</div>";
  80. } elseif ($_GET["error"]==2) {
  81. echo "<div class=\"error\" id=\"divMessages\"><strong>".__("Error on the database server:.")." </strong>".$_GET["des"]."</div>";
  82. }
  83. }
  84. ?>
  85. <div class="tabla">
  86. <table class="sortable" id="admin-table">
  87. <thead>
  88. <tr>
  89. <th scope="col"><?php echo __("Login")?></th>
  90. <th scope="col"><?php echo __("Name")?></th>
  91. <th colspan="2" scope="col" class="unsortable"><?php echo __("Actions")?></th>
  92. </tr>
  93. </thead>
  94. <tbody>
  95. <?php
  96. $odd=false;
  97. $rs = $user->getUsers();
  98. if ($user->contarRegistros()>0) {
  99. while($register = mysql_fetch_array($rs)) {
  100. ?>
  101. <tr <?php if ($odd) { echo 'class="odd"'; } $odd=!$odd; ?>>
  102. <td>
  103. <?php echo $register["login"]."\n"; ?>
  104. </td>
  105. <td>
  106. <?php echo $register["name"]."\n"; ?>
  107. </td>
  108. <td>
  109. <a href="user.php?edit=<?php echo $register["id_user"]; ?>"><?php echo __("Edit")?></a>
  110. </td>
  111. <?php if ($_SESSION["user_id"] != $register["id_user"]) { ?>
  112. <td>
  113. <a href="user.php?delete=<?php echo $register["id_user"]; ?>"><?php echo __("Delete")?></a>
  114. </td>
  115. <?php } ?>
  116. </tr>
  117. <?php
  118. }
  119. }
  120. else {
  121. ?>
  122. <tr>
  123. <td colspan="4"><div class="exito"><?php echo __("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. ?>