rsssubsearch.php 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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_view')) {
  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_uuid = check_str($_POST["rss_sub_uuid"]);
  38. $rss_uuid = check_str($_POST["rss_uuid"]);
  39. $rss_sub_title = check_str($_POST["rss_sub_title"]);
  40. $rss_sub_link = check_str($_POST["rss_sub_link"]);
  41. $rss_sub_description = check_str($_POST["rss_sub_description"]);
  42. $rss_sub_optional_1 = check_str($_POST["rss_sub_optional_1"]);
  43. $rss_sub_optional_2 = check_str($_POST["rss_sub_optional_2"]);
  44. $rss_sub_optional_3 = check_str($_POST["rss_sub_optional_3"]);
  45. $rss_sub_optional_4 = check_str($_POST["rss_sub_optional_4"]);
  46. $rss_sub_optional_5 = check_str($_POST["rss_sub_optional_5"]);
  47. $rss_sub_add_date = check_str($_POST["rss_sub_add_date"]);
  48. $rss_sub_add_user = check_str($_POST["rss_sub_add_user"]);
  49. require_once "resources/header.php";
  50. $sql = "";
  51. $sql .= "select * from v_rss_sub ";
  52. $sql .= "where ";
  53. if (strlen($domain_uuid) > 0) { $sql .= "and rss_sub_uuid = '$domain_uuid' "; }
  54. if (strlen($rss_sub_uuid) > 0) { $sql .= "and rss_sub_uuid like '%$rss_sub_uuid%' "; }
  55. if (strlen($rss_uuid) > 0) { $sql .= "and rss_uuid like '%$rss_uuid%' "; }
  56. if (strlen($rss_sub_title) > 0) { $sql .= "and rss_sub_title like '%$rss_sub_title%' "; }
  57. if (strlen($rss_sub_link) > 0) { $sql .= "and rss_sub_link like '%$rss_sub_link%' "; }
  58. if (strlen($rss_sub_description) > 0) { $sql .= "and rss_sub_description like '%$rss_sub_description%' "; }
  59. if (strlen($rss_sub_optional_1) > 0) { $sql .= "and rss_sub_optional_1 like '%$rss_sub_optional_1%' "; }
  60. if (strlen($rss_sub_optional_2) > 0) { $sql .= "and rss_sub_optional_2 like '%$rss_sub_optional_2%' "; }
  61. if (strlen($rss_sub_optional_3) > 0) { $sql .= "and rss_sub_optional_3 like '%$rss_sub_optional_3%' "; }
  62. if (strlen($rss_sub_optional_4) > 0) { $sql .= "and rss_sub_optional_4 like '%$rss_sub_optional_4%' "; }
  63. if (strlen($rss_sub_optional_5) > 0) { $sql .= "and rss_sub_optional_5 like '%$rss_sub_optional_5%' "; }
  64. if (strlen($rss_sub_add_date) > 0) { $sql .= "and rss_sub_add_date like '%$rss_sub_add_date%' "; }
  65. if (strlen($rss_sub_add_user) > 0) { $sql .= "and rss_sub_add_user like '%$rss_sub_add_user%' "; }
  66. $sql .= "and length(rss_sub_del_date) = 0 ";
  67. $sql .= "or ";
  68. if (strlen($domain_uuid) > 0) { $sql .= "and rss_sub_uuid = '$domain_uuid' "; }
  69. if (strlen($rss_sub_uuid) > 0) { $sql .= "and rss_sub_uuid like '%$rss_sub_uuid%' "; }
  70. if (strlen($rss_uuid) > 0) { $sql .= "and rss_uuid like '%$rss_uuid%' "; }
  71. if (strlen($rss_sub_title) > 0) { $sql .= "and rss_sub_title like '%$rss_sub_title%' "; }
  72. if (strlen($rss_sub_link) > 0) { $sql .= "and rss_sub_link like '%$rss_sub_link%' "; }
  73. if (strlen($rss_sub_description) > 0) { $sql .= "and rss_sub_description like '%$rss_sub_description%' "; }
  74. if (strlen($rss_sub_optional_1) > 0) { $sql .= "and rss_sub_optional_1 like '%$rss_sub_optional_1%' "; }
  75. if (strlen($rss_sub_optional_2) > 0) { $sql .= "and rss_sub_optional_2 like '%$rss_sub_optional_2%' "; }
  76. if (strlen($rss_sub_optional_3) > 0) { $sql .= "and rss_sub_optional_3 like '%$rss_sub_optional_3%' "; }
  77. if (strlen($rss_sub_optional_4) > 0) { $sql .= "and rss_sub_optional_4 like '%$rss_sub_optional_4%' "; }
  78. if (strlen($rss_sub_optional_5) > 0) { $sql .= "and rss_sub_optional_5 like '%$rss_sub_optional_5%' "; }
  79. if (strlen($rss_sub_add_date) > 0) { $sql .= "and rss_sub_add_date like '%$rss_sub_add_date%' "; }
  80. if (strlen($rss_sub_add_user) > 0) { $sql .= "and rss_sub_add_user like '%$rss_sub_add_user%' "; }
  81. $sql .= "and rss_sub_del_date is null ";
  82. $sql = trim($sql);
  83. if (substr($sql, -5) == "where"){ $sql = substr($sql, 0, (strlen($sql)-5)); }
  84. if (substr($sql, -3) == " or"){ $sql = substr($sql, 0, (strlen($sql)-5)); }
  85. $sql = str_replace ("where and", "where", $sql);
  86. $sql = str_replace ("or and", "or", $sql);
  87. $prep_statement = $db->prepare(check_sql($sql));
  88. $prep_statement->execute();
  89. $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
  90. $result_count = count($result);
  91. $c = 0;
  92. $row_style["0"] = "background-color: #F5F5DC;";
  93. $row_style["1"] = "background-color: #FFFFFF;";
  94. echo "<b>".$text['label-search']."</b><br>";
  95. echo "<table border='0' cellpadding='1' cellspacing='1'>\n";
  96. echo " <tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>";
  97. if ($result_count == 0) { //no results
  98. echo "<tr><td>&nbsp;</td></tr>";
  99. }
  100. else { //received results
  101. echo "<tr>";
  102. echo "<th nowrap>&nbsp; &nbsp; ".$text['label-sub-id']."&nbsp; &nbsp; </th>";
  103. echo "<th nowrap>&nbsp; &nbsp; ".$text['label-id']."&nbsp; &nbsp; </th>";
  104. echo "<th nowrap>&nbsp; &nbsp; ".$text['label-title']."&nbsp; &nbsp; </th>";
  105. //echo "<th nowrap>&nbsp; &nbsp; Link&nbsp; &nbsp; </th>";
  106. //echo "<th nowrap>&nbsp; &nbsp; rss_sub_description&nbsp; &nbsp; </th>";
  107. //echo "<th nowrap>&nbsp; &nbsp; rss_sub_optional_1&nbsp; &nbsp; </th>";
  108. //echo "<th nowrap>&nbsp; &nbsp; rss_sub_optional_2&nbsp; &nbsp; </th>";
  109. //echo "<th nowrap>&nbsp; &nbsp; rss_sub_optional_3&nbsp; &nbsp; </th>";
  110. //echo "<th nowrap>&nbsp; &nbsp; rss_sub_optional_4&nbsp; &nbsp; </th>";
  111. //echo "<th nowrap>&nbsp; &nbsp; rss_sub_optional_5&nbsp; &nbsp; </th>";
  112. //echo "<th nowrap>&nbsp; &nbsp; rss_sub_add_date&nbsp; &nbsp; </th>";
  113. //echo "<th nowrap>&nbsp; &nbsp; rss_sub_add_user&nbsp; &nbsp; </th>";
  114. echo "</tr>";
  115. echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>\n";
  116. foreach($result as $row) {
  117. //print_r( $row );
  118. echo "<tr style='".$row_style[$c]."'>\n";
  119. echo "<td valign='top'><a href='rsssubupdate.php?rss_sub_uuid=".escape($row[rss_sub_uuid])."'>".escape($row[rss_sub_uuid])."</a></td>";
  120. echo "<td valign='top'>".escape($row[rss_uuid])."</td>";
  121. echo "<td valign='top'>".escape($row[rss_sub_title])."</td>";
  122. //echo "<td valign='top'>".escape($row[rss_sub_link])."</td>";
  123. //echo "<td valign='top'>".escape($row[rss_sub_description])."</td>";
  124. //echo "<td valign='top'>".escape($row[rss_sub_optional_1])."</td>";
  125. //echo "<td valign='top'>".escape($row[rss_sub_optional_2])."</td>";
  126. //echo "<td valign='top'>".escape($row[rss_sub_optional_3])."</td>";
  127. //echo "<td valign='top'>".escape($row[rss_sub_optional_4])."</td>";
  128. //echo "<td valign='top'>".escape($row[rss_sub_optional_5])."</td>";
  129. //echo "<td valign='top'>".escape($row[rss_sub_add_date])."</td>";
  130. //echo "<td valign='top'>".escape($row[rss_sub_add_user])."</td>";
  131. echo "</tr>";
  132. echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>\n";
  133. if ($c==0) { $c=1; } else { $c=0; }
  134. } //end foreach
  135. unset($sql, $result, $row_count);
  136. } //end if results
  137. echo "</table>\n";
  138. echo "<br><br>";
  139. require_once "resources/footer.php";
  140. unset ($result_count);
  141. unset ($result);
  142. unset ($key);
  143. unset ($val);
  144. unset ($c);
  145. }
  146. else {
  147. require_once "resources/header.php";
  148. echo "<form method='post' action=''>";
  149. echo "<table>";
  150. echo " <tr>";
  151. echo " <td>".$text['label-sub-id']."</td>";
  152. echo " <td><input type='text' class='txt' name='rss_sub_uuid'></td>";
  153. echo " </tr>";
  154. echo " <tr>";
  155. echo " <td>".$text['label-id']."</td>";
  156. echo " <td><input type='text' class='txt' name='rss_uuid'></td>";
  157. echo " </tr>";
  158. echo " <tr>";
  159. echo " <td>".$text['label-sub-title']."</td>";
  160. echo " <td><input type='text' class='txt' name='rss_sub_title'></td>";
  161. echo " </tr>";
  162. echo " <tr>";
  163. echo " <td>".$text['label-sub-link']."</td>";
  164. echo " <td><input type='text' class='txt' name='rss_sub_link'></td>";
  165. echo " </tr>";
  166. echo " <tr>";
  167. echo " <td>".$text['label-sub-desc']."</td>";
  168. echo " <td><input type='text' class='txt' name='rss_sub_description'></td>";
  169. echo " </tr>";
  170. //echo " <tr>";
  171. //echo " <td>rss_sub_optional_1</td>";
  172. //echo " <td><input type='text' class='txt' name='rss_sub_optional_1'></td>";
  173. //echo " </tr>";
  174. //echo " <tr>";
  175. //echo " <td>rss_sub_optional_2</td>";
  176. //echo " <td><input type='text' class='txt' name='rss_sub_optional_2'></td>";
  177. //echo " </tr>";
  178. //echo " <tr>";
  179. //echo " <td>rss_sub_optional_3</td>";
  180. //echo " <td><input type='text' class='txt' name='rss_sub_optional_3'></td>";
  181. //echo " </tr>";
  182. //echo " <tr>";
  183. //echo " <td>rss_sub_optional_4</td>";
  184. //echo " <td><input type='text' class='txt' name='rss_sub_optional_4'></td>";
  185. //echo " </tr>";
  186. //echo " <tr>";
  187. //echo " <td>rss_sub_optional_5</td>";
  188. //echo " <td><input type='text' class='txt' name='rss_sub_optional_5'></td>";
  189. //echo " </tr>";
  190. //echo " <tr>";
  191. //echo " <td>rss_sub_add_date</td>";
  192. //echo " <td><input type='text' class='txt' name='rss_sub_add_date'></td>";
  193. //echo " </tr>";
  194. //echo " <tr>";
  195. //echo " <td>rss_sub_add_user</td>";
  196. //echo " <td><input type='text' class='txt' name='rss_sub_add_user'></td>";
  197. //echo " </tr>";
  198. echo " <tr>";
  199. echo " <td colspan='2' align='right'><input type='submit' name='submit' class='btn' value='".$text['button-search']."'></td>";
  200. echo " </tr>";
  201. echo "</table>";
  202. echo "</form>";
  203. require_once "resources/footer.php";
  204. } //end if not post
  205. ?>