A tumblelog CMS built on AJAX, PHP and MySQL.

user.php 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. ?>
  11. <?php
  12. require('../entry.php');
  13. global $user, $conf, $tumble;
  14. $isEdition = isset($_GET["edit"]);
  15. $userId = ($isEdition) ? $_GET["edit"] : NULL;
  16. if ($user->isAdmin()) {
  17. if (isset($_GET["delete"])) {
  18. $user->deleteUser($_GET['delete']);
  19. header("Location: admin.php?delete=true");
  20. die();
  21. }
  22. if(isset($_POST["btnAdd"])) {
  23. unset($_POST["btnAdd"]);
  24. if (isset($_POST["repass"])) {
  25. unset($_POST["repass"]);
  26. }
  27. if (isset($_POST["btnVerifyUser"])) {
  28. unset($_POST["btnVerifyUser"]);
  29. }
  30. if (isset($_POST["id_user"])) {
  31. $user->modifyUser($_POST, $_POST["id_user"]);
  32. } else {
  33. $user->addUser($_POST);
  34. }
  35. } else {
  36. if ($isEdition) {
  37. $register = $user->getUserByID($userId);
  38. }
  39. ?>
  40. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  41. <html xmlns="http://www.w3.org/1999/xhtml">
  42. <head>
  43. <title>gelato :: <?php echo __("add user")?></title>
  44. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  45. <meta name="generator" content="gelato cms <?php echo util::version();?>" />
  46. <link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
  47. <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.js"></script>
  48. <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/tools.js"></script>
  49. <style type="text/css" media="screen">
  50. @import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
  51. </style>
  52. </head>
  53. <body>
  54. <div id="div-process" style="display:none;"><?php echo __("Processing request&hellip;");?></div>
  55. <div id="cont">
  56. <div id="head">
  57. <h1><a href="<?php echo $conf->urlGelato;?>/admin/index.php" title="gelato :: <?php echo __("home")?>">gelato cms</a></h1>
  58. <ul id="nav">
  59. <li><a href="<?php echo $conf->urlGelato;?>/" title="<?php echo __("Take me to the tumblelog")?>"><?php echo __("Back to the Tumblelog")?></a></li>
  60. </ul>
  61. </div>
  62. <div id="main">
  63. <div class="box">
  64. <ul class="menu manage">
  65. <h3><?php echo __("Start session")?></h3>
  66. <li><a href="index.php"><?php echo __("Post")?></a></li>
  67. <li><a href="admin.php"><?php echo __("Users")?></a></li>
  68. <li class="selected"><a><?php echo ($isEdition) ? __("Edit") : __("Add"); ?></a></li>
  69. </ul>
  70. <div class="tabla">
  71. <form action="user.php" method="post" onSubmit="return validateFrmAddUser();" name="frm_add" class="newpost">
  72. <fieldset>
  73. <ul>
  74. <?php
  75. if ($isEdition) {
  76. ?>
  77. <input type="hidden" name="id_user" id="id_user" value="<?php echo $userId;?>" />
  78. <?php
  79. }
  80. ?>
  81. <li>
  82. <label for="login"><?php echo __("user:")?></label>
  83. <input class="txt" name="login" id="login" type="text" autocomplete="off" value="<?php echo isset($register["login"])?$register["login"]:"";?>" />
  84. <?php
  85. if (!$isEdition) {
  86. ?>
  87. <br /><input class='submit_normal_azul' name='btnVerifyUser' id='btnVerifyUser' type='button' value='Check availability' onclick='verifyExistingUser()' />
  88. <?php
  89. }
  90. ?>
  91. </li>
  92. <li>
  93. <div id="target" style="display:none;"></div>
  94. </li>
  95. <li>
  96. <label for="pass"><?php echo __("password:")?></label>
  97. <input class="txt" name="password" id="password" type="password" />
  98. </li>
  99. <li>
  100. <label for="repass"><?php echo __("retype password:")?></label>
  101. <input class="txt" name="repass" id="repass" type="password" />
  102. </li>
  103. <li>
  104. <label for="name"><?php echo __("name:")?></label>
  105. <input class="txt" name="name" id="name" type="text" value="<?php echo isset($register["name"])?$register["name"]:"";?>" />
  106. </li>
  107. <li>
  108. <label for="email"><?php echo __("e-mail:")?></label>
  109. <input class="txt" name="email" id="email" type="text" value="<?php echo isset($register["email"])?$register["email"]:"";?>" />
  110. </li>
  111. <li>
  112. <label for="website"><?php echo __("website:")?></label>
  113. <input class="txt" name="website" id="website" type="text" value="<?php echo isset($register["website"])?$register["website"]:"";?>" />
  114. </li>
  115. <li>
  116. <label for="about"><?php echo __("about:")?></label><br />
  117. <textarea rows="5" cols="50" name="about" id="about" tabindex="7"><?php echo isset($register["about"])?$register["about"]:"";?></textarea>
  118. </li>
  119. <li>
  120. <input name="btnAdd" type="submit" value="<?php echo ($isEdition) ? __("Modify") : __("Add"); ?> user" />
  121. </li>
  122. </ul>
  123. </fieldset>
  124. </form>
  125. </div>
  126. <div class="footer-box">&nbsp;</div>
  127. </div>
  128. </div>
  129. <div id="foot">
  130. <a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
  131. </div>
  132. </div>
  133. </body>
  134. </html>
  135. <?php
  136. }
  137. } else {
  138. header("Location: ".$conf->urlGelato."/login.php");
  139. }
  140. ?>