A tumblelog CMS built on AJAX, PHP and MySQL.

admin.php 5.5KB

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