PageRenderTime 28ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/base/users_addedit.php

https://gitlab.com/nexxuz/phpBMS
PHP | 283 lines | 182 code | 60 blank | 41 comment | 31 complexity | 88997f71a1ff1fe47eba78e430406388 MD5 | raw file
  1. <?php
  2. /*
  3. $Rev$ | $LastChangedBy$
  4. $LastChangedDate$
  5. +-------------------------------------------------------------------------+
  6. | Copyright (c) 2004 - 2010, Kreotek LLC |
  7. | All rights reserved. |
  8. +-------------------------------------------------------------------------+
  9. | |
  10. | Redistribution and use in source and binary forms, with or without |
  11. | modification, are permitted provided that the following conditions are |
  12. | met: |
  13. | |
  14. | - Redistributions of source code must retain the above copyright |
  15. | notice, this list of conditions and the following disclaimer. |
  16. | |
  17. | - Redistributions in binary form must reproduce the above copyright |
  18. | notice, this list of conditions and the following disclaimer in the |
  19. | documentation and/or other materials provided with the distribution. |
  20. | |
  21. | - Neither the name of Kreotek LLC nor the names of its contributore may |
  22. | be used to endorse or promote products derived from this software |
  23. | without specific prior written permission. |
  24. | |
  25. | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
  26. | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
  27. | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
  28. | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
  29. | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
  30. | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
  31. | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
  32. | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
  33. | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
  34. | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
  35. | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
  36. | |
  37. +-------------------------------------------------------------------------+
  38. */
  39. include("../../include/session.php");
  40. include("include/tables.php");
  41. include("include/fields.php");
  42. include("include/users.php");
  43. $thetable = new users($db, "tbld:afe6d297-b484-4f0b-57d4-1c39412e9dfb");
  44. $therecord = $thetable->processAddEditPage();
  45. if(isset($therecord["phpbmsStatus"]))
  46. $statusmessage = $therecord["phpbmsStatus"];
  47. $pageTitle="User";
  48. $phpbms->cssIncludes[] = "pages/users.css";
  49. $phpbms->jsIncludes[] = "modules/base/javascript/users.js";
  50. //Form Elements
  51. //==============================================================
  52. $theform = new phpbmsForm();
  53. $theform->onsubmit="return submitForm(this);";
  54. $disabled = false;
  55. if($therecord["portalaccess"])
  56. $disabled = true;
  57. $theinput = new inputCheckbox("adminBox",$therecord["admin"],"administrator", $disabled);
  58. $theform->addField($theinput);
  59. $theinput = new inputCheckbox("revoked",$therecord["revoked"],"access revoked");
  60. $theform->addField($theinput);
  61. $theinput = new inputCheckbox("portalaccess",$therecord["portalaccess"],"portal access");
  62. $theform->addField($theinput);
  63. $theinput = new inputField("firstname",$therecord["firstname"],"first name",true,NULL,32,64);
  64. $theinput->setAttribute("class","important");
  65. $theform->addField($theinput);
  66. $theinput = new inputField("lastname",$therecord["lastname"],"last name",false,NULL,32,64);
  67. $theinput->setAttribute("class","important");
  68. $theform->addField($theinput);
  69. $theinput = new inputField("login",$therecord["login"],"log in name",true,NULL,32,64);
  70. $theinput->setAttribute("class","important");
  71. $theform->addField($theinput);
  72. $theinput = new inputField("phone",$therecord["phone"],"phone/extension",false,"phone",32,64);
  73. $theform->addField($theinput);
  74. $theinput = new inputField("email",$therecord["email"],"e-mail address",false,"email",32,64);
  75. $theinput->setAttribute("title","Enter the email address to send site mail from. Will also be used as part of your contact details.");
  76. $theform->addField($theinput);
  77. if(!$therecord["id"]) $therecord["sendmail"] = "/usr/sbin/sendmail -bs"; // Set default
  78. $theinput = new inputField("sendmail",$therecord["sendmail"],"sendmail path",false,null,32,255);
  79. $theinput->setAttribute("title","Enter the path to the sendmail program directory on the host server. Defaults to: '/usr/sbin/sendmail -bs'");
  80. $theform->addField($theinput);
  81. if(!$therecord["id"]) $therecord["smtphost"] = "localhost"; // Set default
  82. $theinput = new inputField("smtphost",$therecord["smtphost"],"SMTP host",false,null,32,255);
  83. $theinput->setAttribute("title","Enter the name of the SMTP host. Defaults to: 'localhost'");
  84. $theform->addField($theinput);
  85. if(!$therecord["id"]) $therecord["smtpport"] = 25; // Set default
  86. $theinput = new inputField("smtpport",$therecord["smtpport"],"SMTP port",false,"integer",10,10);
  87. $theinput->setAttribute("title","Enter the port number of your SMTP server. Use 25 for most unsecure servers and 465 for most secure servers. Defaults to: 25");
  88. $theform->addField($theinput);
  89. $theinput = new inputField("smtpuser",$therecord["smtpuser"],"SMTP username",false,NULL,32,255);
  90. $theinput->setAttribute("title","Enter the username for access to the SMTP host.");
  91. $theform->addField($theinput);
  92. $theinput = new inputField("smtppass",$therecord["smtppass"],"SMTP password",false,"password",32,255);
  93. $theinput->setAttribute("title","Enter the password for the SMTP host.");
  94. $theform->addField($theinput);
  95. $theinput = new inputField("lastip", $therecord["lastip"], "last log in IP");
  96. $theinput->setAttribute("readonly", "readonly");
  97. $theinput->setAttribute("class", "uneditable");
  98. $theform->addField($theinput);
  99. $theinput = new inputChoiceList($db,"department",$therecord["department"],"department");
  100. $theform->addField($theinput);
  101. $thetable->getCustomFieldInfo();
  102. $theform->prepCustomFields($db, $thetable->customFieldsQueryResult, $therecord);
  103. $theform->jsMerge();
  104. //==============================================================
  105. //End Form Elements
  106. include("header.php");
  107. ?><div class="bodyline">
  108. <?php $theform->startForm($pageTitle)?>
  109. <fieldset id="fsAttributes">
  110. <legend>attributes</legend>
  111. <p>
  112. <input type="hidden" id="admin" name="admin" value="<?php echo $therecord["admin"]?>" />
  113. <?php $theform->showField("adminBox");?>
  114. </p>
  115. <p><?php $theform->showField("revoked");?></p>
  116. <p><?php $theform->showField("portalaccess");?></p>
  117. <p class="notes">
  118. user accounts marked as portal access cannot login to phpBMS, but are used by external applications
  119. when creating/modifying information from outside the application for recording purposes.
  120. </p>
  121. </fieldset>
  122. <div id="leftSideDiv">
  123. <fieldset id="fsName">
  124. <legend>name</legend>
  125. <p id="firstnameP" class="big"><?php $theform->showField("firstname");?></p>
  126. <p class="big"><?php $theform->showField("lastname");?></p>
  127. </fieldset>
  128. <fieldset>
  129. <legend>log in</legend>
  130. <p class="big"><?php $theform->showField("login");?></p>
  131. <p>
  132. <label for="lastlogin" >last log in</label><br />
  133. <input id="lastlogin" name="lastlogin" type="text" value="<?php echo formatFromSQLDateTime($therecord["lastlogin"]); ?>" size="32" maxlength="64" readonly="readonly" class="uneditable" />
  134. </p>
  135. <p><?php $theform->showField("lastip"); ?></p>
  136. <p>
  137. <label for="password">set new password</label><br />
  138. <input id="password" name="password" type="password" size="32" maxlength="32" />
  139. </p>
  140. <p>
  141. <label for="password2">confirm new password</label><br />
  142. <input id="password2" name="password2" type="password" size="32" maxlength="32" />
  143. </p>
  144. </fieldset>
  145. <fieldset>
  146. <legend>contact / user information</legend>
  147. <p><?php $theform->showField("email");?></p>
  148. <p><?php $theform->showField("phone");?></p>
  149. <p><?php $theform->showField("department");?></p>
  150. <p>
  151. <label for="employeenumber">employee number</label><br />
  152. <input type="text" id="employeenumber" name="employeenumber" value="<?php echo htmlQuotes($therecord["employeenumber"]) ?>" size="32" maxlength="32" />
  153. </p>
  154. </fieldset>
  155. <fieldset>
  156. <legend>E-Mail Settings</legend>
  157. <p><?php $theform->showField("email")?></p>
  158. <p><label for="mailer">select the mailer to use</label><br />
  159. <select id="mailer" name="mailer" style="width: 80px;" title="Select which mailer for the delivery of site email. Defaults to: 'PHP Mail'">
  160. <option value="mail" <?php if($therecord["mailer"] == "mail") echo "selected=\"selected\"";?> >PHP Mail</option>
  161. <option value="sendmail" <?php if($therecord["mailer"] == "sendmail") echo "selected=\"selected\"";?> >Sendmail</option>
  162. <option value="smtp" <?php if($therecord["mailer"] == "smtp") echo "selected=\"selected\"";?> >SMTP</option>
  163. </select></p>
  164. <fieldset style="width: 250px;">
  165. <legend>Sendmail Settings</legend>
  166. <p class="notes"><strong>Note:</strong> Only used if mailer is set to use Sendmail</p>
  167. <p><?php $theform->showField("sendmail")?></p>
  168. </fieldset>
  169. <fieldset style="width: 250px;">
  170. <legend>SMTP Settings</legend>
  171. <p class="notes"><strong>Note:</strong> Only used if mailer is set to use SMTP</p>
  172. <p><?php $theform->showField("smtphost")?></p>
  173. <p><?php $theform->showField("smtpport")?></p>
  174. <p><label for="smtpauth" title="Select Yes if your SMTP Host requires SMTP Authentication. Defaults to: 'No'">SMTP authentication</label><br />
  175. <input type="radio" id="smtpauth0" name="smtpauth" value="1" <?php if($therecord["smtpauth"] == 1) echo "checked=\"checked\"";?> /><label for="smtpauth0">Yes</label>
  176. <input type="radio" id="smtpauth1" name="smtpauth" value="0" <?php if($therecord["smtpauth"] == 0) echo "checked=\"checked\"";?> /><label for="smtpauth1">No</label></p>
  177. <p><?php $theform->showField("smtpuser")?></p>
  178. <p><?php $theform->showField("smtppass")?></p>
  179. <p><label for="smtpsecure" >SMTP security</label><br />
  180. <select id="smtpsecure" name="smtpsecure" style="width: 80px;" title="Select the security model that your SMTP server uses. Defaults to: 'None'">
  181. <option value="none" <?php if($therecord["smtpsecure"] == "none") echo "selected=\"selected\"";?> >None</option>
  182. <option value="ssl" <?php if($therecord["smtpsecure"] == "ssl") echo "selected=\"selected\"";?> >SSL</option>
  183. <option value="tls" <?php if($therecord["smtpsecure"] == "tls") echo "selected=\"selected\"";?> >TLS</option>
  184. </select></p>
  185. </fieldset>
  186. </fieldset>
  187. <?php $theform->showCustomFields($db, $thetable->customFieldsQueryResult) ?>
  188. <?php if($therecord["id"]){?>
  189. <fieldset>
  190. <legend>roles</legend>
  191. <input type="hidden" name="roleschanged" id="roleschanged" value="0" />
  192. <input type="hidden" name="newroles" id="newroles" value="" />
  193. <div class="fauxP">
  194. <div id="assignedrolesdiv">
  195. assigned roles<br />
  196. <select id="assignedroles" size="10" multiple="multiple">
  197. <?php $thetable->displayRoles($therecord["uuid"], "assigned")?>
  198. </select>
  199. </div>
  200. <div id="rolebuttonsdiv">
  201. <p>
  202. <button type="button" class="Buttons" onclick="moveRole('availableroles','assignedroles')">&lt; add role</button>
  203. </p>
  204. <p>
  205. <button type="button" class="Buttons" onclick="moveRole('assignedroles','availableroles')">remove role &gt;</button>
  206. </p>
  207. </div>
  208. <div id="availablerolesdiv">
  209. available roles<br />
  210. <select id="availableroles" size="10" multiple="multiple">
  211. <?php $thetable->displayRoles($therecord["uuid"],"available")?>
  212. </select>
  213. </div>
  214. </div>
  215. </fieldset>
  216. <?php }?>
  217. </div>
  218. <?php
  219. $theform->showGeneralInfo($phpbms,$therecord);
  220. $theform->endForm();
  221. ?>
  222. </div>
  223. <?php include("footer.php");?>