rsssubupdate.php 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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. $rss_uuid = $_GET["rss_uuid"];
  37. if (count($_POST)>0 && $_POST["persistform"] == "0") {
  38. $rss_sub_uuid = check_str($_POST["rss_sub_uuid"]);
  39. $rss_uuid = check_str($_POST["rss_uuid"]);
  40. $rss_sub_title = check_str($_POST["rss_sub_title"]);
  41. $rss_sub_link = check_str($_POST["rss_sub_link"]);
  42. $rss_sub_description = check_str($_POST["rss_sub_description"]);
  43. $rss_sub_optional_1 = check_str($_POST["rss_sub_optional_1"]);
  44. $rss_sub_optional_2 = check_str($_POST["rss_sub_optional_2"]);
  45. $rss_sub_optional_3 = check_str($_POST["rss_sub_optional_3"]);
  46. $rss_sub_optional_4 = check_str($_POST["rss_sub_optional_4"]);
  47. $rss_sub_optional_5 = check_str($_POST["rss_sub_optional_5"]);
  48. $rss_sub_add_date = check_str($_POST["rss_sub_add_date"]);
  49. $rss_sub_add_user = check_str($_POST["rss_sub_add_user"]);
  50. $msg = '';
  51. if (strlen($rss_uuid) == 0) { $msg .= $text['message-error-missing']." rss_uuid.<br>\n"; }
  52. if (strlen($rss_sub_uuid) == 0) { $msg .= $text['message-error-missing']." rss_sub_uuid.<br>\n"; }
  53. //if (strlen($rss_sub_title) == 0) { $msg .= "Please provide a title.<br>\n"; }
  54. if (strlen($rss_sub_description) == 0) { $msg .= $text['message-description']."<br>\n"; }
  55. if (strlen($msg) > 0) {
  56. require_once "resources/persist_form.php";
  57. require_once "resources/header.php";
  58. echo "<div align='center'>";
  59. echo "<table>";
  60. echo "<tr>";
  61. echo "<td>";
  62. echo " <div class='borderlight' align='left' style='padding:10px;'>";
  63. echo " $msg";
  64. echo " <br>";
  65. echo " <div align='center'>".persistform($_POST)."</div>";
  66. echo " </div>";
  67. echo "</td>";
  68. echo "</tr>";
  69. echo "</table>";
  70. echo "</div>";
  71. require_once "resources/footer.php";
  72. return;
  73. }
  74. //sql update
  75. $sql = "update v_rss_sub set ";
  76. //$sql .= "rss_uuid = '$rss_uuid', ";
  77. $sql .= "rss_sub_title = '$rss_sub_title', ";
  78. $sql .= "rss_sub_link = '$rss_sub_link', ";
  79. $sql .= "rss_sub_description = '$rss_sub_description', ";
  80. $sql .= "rss_sub_optional_1 = '$rss_sub_optional_1', ";
  81. $sql .= "rss_sub_optional_2 = '$rss_sub_optional_2', ";
  82. $sql .= "rss_sub_optional_3 = '$rss_sub_optional_3', ";
  83. $sql .= "rss_sub_optional_4 = '$rss_sub_optional_4', ";
  84. $sql .= "rss_sub_optional_5 = '$rss_sub_optional_5' ";
  85. //$sql .= "rss_sub_add_date = now(), ";
  86. //$sql .= "rss_sub_add_user = '".$_SESSION["username"]."' ";
  87. $sql .= "where domain_uuid = '$domain_uuid' ";
  88. $sql .= "and rss_sub_uuid = '$rss_sub_uuid' ";
  89. //$sql .= "and rss_uuid = '$rss_uuid' ";
  90. $count = $db->exec(check_sql($sql));
  91. //echo "Affected Rows: ".$count;
  92. $_SESSION["message"] = $text['message-update'];
  93. header("Location: rsssublist.php?rss_uuid=".$rss_uuid."&rss_sub_uuid=".$rss_sub_uuid);
  94. return;
  95. }
  96. else {
  97. //get data from the db
  98. $rss_sub_uuid = $_GET["rss_sub_uuid"];
  99. $sql = "";
  100. $sql .= "select * from v_rss_sub ";
  101. $sql .= "where domain_uuid = '$domain_uuid' ";
  102. $sql .= "and rss_sub_uuid = '$rss_sub_uuid' ";
  103. $prep_statement = $db->prepare(check_sql($sql));
  104. $prep_statement->execute();
  105. $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
  106. foreach ($result as &$row) {
  107. //$rss_uuid = $row["rss_uuid"];
  108. $rss_sub_title = $row["rss_sub_title"];
  109. $rss_sub_link = $row["rss_sub_link"];
  110. $rss_sub_description = $row["rss_sub_description"];
  111. $rss_sub_optional_1 = $row["rss_sub_optional_1"];
  112. $rss_sub_optional_2 = $row["rss_sub_optional_2"];
  113. $rss_sub_optional_3 = $row["rss_sub_optional_3"];
  114. $rss_sub_optional_4 = $row["rss_sub_optional_4"];
  115. $rss_sub_optional_5 = $row["rss_sub_optional_5"];
  116. $rss_sub_add_date = $row["rss_sub_add_date"];
  117. $rss_sub_add_user = $row["rss_sub_add_user"];
  118. break; //limit to 1 row
  119. }
  120. }
  121. //show the header
  122. require_once "resources/header.php";
  123. require_once "resources/wysiwyg.php";
  124. //show the content
  125. echo "<form method='post' action=''>";
  126. echo "<table cellpadding='0' cellspacing='0' width='100%'>";
  127. //echo " <tr>";
  128. //echo " <td>rss_uuid</td>";
  129. //echo " <td><input type='text' name='rss_uuid' class='txt' value='$rss_uuid'></td>";
  130. //echo " </tr>";
  131. echo " <tr>";
  132. echo " <td nowrap>".$text['label-sub-title']."</td>";
  133. echo " <td width='100%'><input type='text' name='rss_sub_title' class='txt' value='".escape($rss_sub_title)."'></td>";
  134. echo " </tr>";
  135. echo " <tr>";
  136. echo " <td>".$text['label-sub-link']."</td>";
  137. echo " <td><input type='text' name='rss_sub_link' class='txt' value='".escape($rss_sub_link)."'></td>";
  138. echo " </tr>";
  139. echo " <tr>";
  140. echo " <td valign='top'>".$text['label-description']."</td>";
  141. echo " <td>";
  142. echo " <textarea name='rss_sub_description' rows='12' class='txt'>".escape($rss_sub_description)."</textarea>";
  143. echo " </td>";
  144. echo " </tr>";
  145. //echo " <tr>";
  146. //echo " <td>rss_sub_optional_1</td>";
  147. //echo " <td><input type='text' name='rss_sub_optional_1' value='".escape($rss_sub_optional_1)."'></td>";
  148. //echo " </tr>";
  149. //echo " <tr>";
  150. //echo " <td>rss_sub_optional_2</td>";
  151. //echo " <td><input type='text' name='rss_sub_optional_2' value='".escape($rss_sub_optional_2)."'></td>";
  152. //echo " </tr>";
  153. //echo " <tr>";
  154. //echo " <td>rss_sub_optional_3</td>";
  155. //echo " <td><input type='text' name='rss_sub_optional_3' value='".escape($rss_sub_optional_3)."'></td>";
  156. //echo " </tr>";
  157. //echo " <tr>";
  158. //echo " <td>rss_sub_optional_4</td>";
  159. //echo " <td><input type='text' name='rss_sub_optional_4' value='".escape($rss_sub_optional_4)."'></td>";
  160. //echo " </tr>";
  161. //echo " <tr>";
  162. //echo " <td>rss_sub_optional_5</td>";
  163. //echo " <td><input type='text' name='rss_sub_optional_5' value='".escape($rss_sub_optional_5)."'></td>";
  164. //echo " </tr>";
  165. echo " <tr>";
  166. echo " <td colspan='2' align='right'>";
  167. echo " <input type='hidden' name='rss_uuid' value='".escape($rss_uuid)."'>";
  168. echo " <input type='hidden' name='persistform' value='0'>";
  169. echo " <input type='hidden' name='rss_sub_uuid' value='".escape($rss_sub_uuid)."'>";
  170. echo " <br><br>";
  171. echo " <input type='submit' name='submit' class='btn' value='".$text['button-update']."'>";
  172. echo " </td>";
  173. echo " </tr>";
  174. echo "</table>";
  175. echo "<br><br>";
  176. echo "</form>";
  177. //show the footer
  178. require_once "resources/footer.php";
  179. ?>