groupadd.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <?php
  2. /*
  3. FusionPBX
  4. Version: MPL 1.1
  5. The contents of this file are subject to the Mozilla Public License Version
  6. 1.1 (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.mozilla.org/MPL/
  9. Software distributed under the License is distributed on an "AS IS" basis,
  10. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11. for the specific language governing rights and limitations under the
  12. License.
  13. The Original Code is FusionPBX
  14. The Initial Developer of the Original Code is
  15. Mark J Crane <[email protected]>
  16. Portions created by the Initial Developer are Copyright (C) 2008-2012
  17. the Initial Developer. All Rights Reserved.
  18. Contributor(s):
  19. Mark J Crane <[email protected]>
  20. */
  21. include "root.php";
  22. require_once "includes/require.php";
  23. require_once "includes/checkauth.php";
  24. if (permission_exists('group_add')) {
  25. //access allowed
  26. }
  27. else {
  28. echo "access denied";
  29. return;
  30. }
  31. //get the http values and set them as variables
  32. $path = check_str($_GET["path"]);
  33. $msg = check_str($_GET["msg"]);
  34. $group_name = check_str($_POST["group_name"]);
  35. $group_description = check_str($_POST["group_description"]);
  36. if (strlen($group_name) > 0) {
  37. $sql_insert = "insert into v_groups ";
  38. $sql_insert .= "(";
  39. $sql_insert .= "domain_uuid, ";
  40. $sql_insert .= "group_uuid, ";
  41. $sql_insert .= "group_name, ";
  42. $sql_insert .= "group_description ";
  43. $sql_insert .= ")";
  44. $sql_insert .= "values ";
  45. $sql_insert .= "(";
  46. $sql_insert .= "'$domain_uuid', ";
  47. $sql_insert .= "'".uuid()."', ";
  48. $sql_insert .= "'$group_name', ";
  49. $sql_insert .= "'$group_description' ";
  50. $sql_insert .= ")";
  51. if (!$db->exec($sql_insert)) {
  52. //echo $db->errorCode() . "<br>";
  53. $info = $db->errorInfo();
  54. print_r($info);
  55. // $info[0] == $db->errorCode() unified error code
  56. // $info[1] is the driver specific error code
  57. // $info[2] is the driver specific error string
  58. }
  59. //redirect the user
  60. require_once "includes/header.php";
  61. echo "<meta http-equiv=\"refresh\" content=\"2;url=grouplist.php\">\n";
  62. echo "<div align='center'>\n";
  63. echo "Group Added\n";
  64. echo "</div>\n";
  65. require_once "includes/footer.php";
  66. return;
  67. }
  68. //include the header
  69. include "includes/header.php";
  70. //show the content
  71. echo "<br><br>";
  72. echo "<div align='center'>";
  73. echo "<table width='100%' cellpadding='6' cellspacing='0'>\n";
  74. echo " <tr>\n";
  75. echo " <td align='left'>\n";
  76. echo " Please choose a group name. ";
  77. echo " </td>\n";
  78. echo " <td align='right'>\n";
  79. echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='grouplist.php'\" value='Back'> ";
  80. echo " </td>\n";
  81. echo " </tr>\n";
  82. echo "</table>\n";
  83. echo "<br>";
  84. echo "<form name='login' METHOD=\"POST\" action=\"groupadd.php\">\n";
  85. echo "<table width='100%' cellpadding='6' cellspacing='0'>\n";
  86. echo "<tr>\n";
  87. echo "<td width='30%' class='vncellreq'>\n";
  88. echo "Group Name:\n";
  89. echo "</td>\n";
  90. echo "<td width='70%' align='left' class='vtable'>\n";
  91. echo " <input type=\"text\" class='formfld' name=\"group_name\">\n";
  92. echo "</td>\n";
  93. echo "</tr>\n";
  94. echo "<tr>\n";
  95. echo "<td class='vncellreq'>\n";
  96. echo "Description:\n";
  97. echo "</td>\n";
  98. echo "<td align='left' class='vtable'>\n";
  99. echo "<textarea name='group_description' class='formfld'></textarea>\n";
  100. echo "</td>\n";
  101. echo "</tr>\n";
  102. echo "<tr>\n";
  103. echo "<td>\n";
  104. echo "</td>\n";
  105. echo "<td align=\"right\">\n";
  106. echo " <input type=\"hidden\" name=\"path\" value=\"$path\">\n";
  107. echo " <input type=\"submit\" class='btn' value=\"Save\">\n";
  108. echo "</td>\n";
  109. echo "</tr>\n";
  110. echo "</table>\n";
  111. echo "</form>";
  112. echo "</div>";
  113. echo "<br><br>";
  114. echo "<br><br>";
  115. //include the footer
  116. include "includes/footer.php";
  117. ?>