A tumblelog CMS built on AJAX, PHP and MySQL.

user.php 5.4KB

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