A tumblelog CMS built on AJAX, PHP and MySQL.

admin.php 5.4KB

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