rsssubcategoryupdate.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. James Rose <[email protected]>
  21. */
  22. include "root.php";
  23. require_once "resources/require.php";
  24. require_once "resources/check_auth.php";
  25. require_once "config.php";
  26. if (permission_exists('content_edit')) {
  27. //access granted
  28. }
  29. else {
  30. echo "access denied";
  31. exit;
  32. }
  33. //add multi-lingual support
  34. $language = new text;
  35. $text = $language->get();
  36. if (count($_POST)>0) {
  37. $rss_sub_category_uuid = check_str($_POST["rss_sub_category_uuid"]);
  38. $rss_category = check_str($_POST["rss_category"]);
  39. $rss_sub_category = check_str($_POST["rss_sub_category"]);
  40. $rss_sub_category_description = check_str($_POST["rss_sub_category_description"]);
  41. $rss_add_user = check_str($_POST["rss_add_user"]);
  42. $rss_add_date = check_str($_POST["rss_add_date"]);
  43. //sql update
  44. $sql = "update v_rss_sub_category set ";
  45. $sql .= "rss_category = '$rss_category', ";
  46. $sql .= "rss_sub_category = '$rss_sub_category', ";
  47. $sql .= "rss_sub_category_description = '$rss_sub_category_description', ";
  48. $sql .= "rss_add_user = '$rss_add_user', ";
  49. $sql .= "rss_add_date = '$rss_add_date' ";
  50. $sql .= "where domain_uuid = '$domain_uuid' ";
  51. $sql .= "and rss_sub_category_uuid = '$rss_sub_category_uuid' ";
  52. $count = $db->exec(check_sql($sql));
  53. //echo "Affected Rows: ".$count;
  54. $_SESSION["message"] = $text['message-update'];
  55. header("Location: rss_sub_categorylist.php");
  56. return;
  57. }
  58. else {
  59. //get data from the db
  60. $rss_sub_category_uuid = $_GET["rss_sub_category_uuid"];
  61. $sql = "";
  62. $sql .= "select * from v_rss_sub_category ";
  63. $sql .= "where domain_uuid = '$domain_uuid' ";
  64. $sql .= "and rss_sub_category_uuid = '$rss_sub_category_uuid' ";
  65. $prep_statement = $db->prepare(check_sql($sql));
  66. $prep_statement->execute();
  67. $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
  68. foreach ($result as &$row) {
  69. $rss_category = $row["rss_category"];
  70. $rss_sub_category = $row["rss_sub_category"];
  71. $rss_sub_category_description = $row["rss_sub_category_description"];
  72. $rss_add_user = $row["rss_add_user"];
  73. $rss_add_date = $row["rss_add_date"];
  74. break; //limit to 1 row
  75. }
  76. }
  77. require_once "resources/header.php";
  78. echo "<form method='post' action=''>";
  79. echo "<table>";
  80. echo " <tr>";
  81. echo " <td>rss_category</td>";
  82. echo " <td><input type='text' name='rss_category' value='".escape($rss_category)."'></td>";
  83. echo " </tr>";
  84. echo " <tr>";
  85. echo " <td>rss_sub_category</td>";
  86. echo " <td><input type='text' name='rss_sub_category' value='".escape($rss_sub_category)."'></td>";
  87. echo " </tr>";
  88. echo " <tr>";
  89. echo " <td>rss_sub_category_description</td>";
  90. echo " <td><input type='text' name='rss_sub_category_description' value='".escape($rss_sub_category_description)."'></td>";
  91. echo " </tr>";
  92. echo " <tr>";
  93. echo " <td>rss_add_user</td>";
  94. echo " <td><input type='text' name='rss_add_user' value='".escape($rss_add_user)."'></td>";
  95. echo " </tr>";
  96. echo " <tr>";
  97. echo " <td>rss_add_date</td>";
  98. echo " <td><input type='text' name='rss_add_date' value='".escape($rss_add_date)."'></td>";
  99. echo " </tr>";
  100. echo " <tr>";
  101. echo " <td colspan='2' align='right'>";
  102. echo " <input type='hidden' name='rss_sub_category_uuid' value='".escape($rss_sub_category_uuid)."'>";
  103. echo " <br><br>";
  104. echo " <input type='submit' name='submit' value='".$text['button-update']."'>";
  105. echo " </td>";
  106. echo " </tr>";
  107. echo "</table>";
  108. echo "<br><br>";
  109. echo "</form>";
  110. require_once "resources/footer.php";
  111. ?>