rsssearch.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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. return; //disabled
  23. include "root.php";
  24. require_once "resources/require.php";
  25. require_once "resources/check_auth.php";
  26. require_once "config.php";
  27. if (permission_exists('content_view')) {
  28. //access granted
  29. }
  30. else {
  31. echo "access denied";
  32. exit;
  33. }
  34. //add multi-lingual support
  35. $language = new text;
  36. $text = $language->get();
  37. if (count($_POST)>0) {
  38. $rss_uuid = check_str($_POST["rss_uuid"]);
  39. //$rss_category = check_str($_POST["rss_category"]); //defined in local config.php
  40. $rss_sub_category = check_str($_POST["rss_sub_category"]);
  41. $rss_title = check_str($_POST["rss_title"]);
  42. $rss_link = check_str($_POST["rss_link"]);
  43. $rss_description = check_str($_POST["rss_description"]);
  44. $rss_img = check_str($_POST["rss_img"]);
  45. $rss_optional_1 = check_str($_POST["rss_optional_1"]);
  46. $rss_optional_2 = check_str($_POST["rss_optional_2"]);
  47. $rss_optional_3 = check_str($_POST["rss_optional_3"]);
  48. $rss_optional_4 = check_str($_POST["rss_optional_4"]);
  49. $rss_optional_5 = check_str($_POST["rss_optional_5"]);
  50. $rss_add_date = check_str($_POST["rss_add_date"]);
  51. $rss_add_user = check_str($_POST["rss_add_user"]);
  52. require_once "resources/header.php";
  53. echo "<div align='center'>";
  54. echo "<table border='0' cellpadding='0' cellspacing='2'>\n";
  55. echo "<tr class='border'>\n";
  56. echo " <td align=\"left\">\n";
  57. echo " <br>";
  58. $sql = "";
  59. $sql .= "select * from v_rss ";
  60. $sql .= "where ";
  61. if (strlen($rss_uuid) > 0) { $sql .= "and rss_uuid like '%$rss_uuid%' "; }
  62. if (strlen($rss_category) > 0) { $sql .= "and rss_category like '%$rss_category%' "; }
  63. if (strlen($rss_sub_category) > 0) { $sql .= "and rss_sub_category like '%$rss_sub_category%' "; }
  64. if (strlen($rss_title) > 0) { $sql .= "and rss_title like '%$rss_title%' "; }
  65. if (strlen($rss_link) > 0) { $sql .= "and rss_link like '%$rss_link%' "; }
  66. if (strlen($rss_description) > 0) { $sql .= "and rss_description like '%$rss_description%' "; }
  67. if (strlen($rss_img) > 0) { $sql .= "and rss_img like '%$rss_img%' "; }
  68. if (strlen($rss_optional_1) > 0) { $sql .= "and rss_optional_1 like '%$rss_optional_1%' "; }
  69. if (strlen($rss_optional_2) > 0) { $sql .= "and rss_optional_2 like '%$rss_optional_2%' "; }
  70. if (strlen($rss_optional_3) > 0) { $sql .= "and rss_optional_3 like '%$rss_optional_3%' "; }
  71. if (strlen($rss_optional_4) > 0) { $sql .= "and rss_optional_4 like '%$rss_optional_4%' "; }
  72. if (strlen($rss_optional_5) > 0) { $sql .= "and rss_optional_5 like '%$rss_optional_5%' "; }
  73. if (strlen($rss_add_date) > 0) { $sql .= "and rss_add_date like '%$rss_add_date%' "; }
  74. if (strlen($rss_add_user) > 0) { $sql .= "and rss_add_user like '%$rss_add_user%' "; }
  75. $sql .= "and length(rss_del_date) = 0 ";
  76. $sql .= "or ";
  77. if (strlen($rss_uuid) > 0) { $sql .= "and rss_uuid like '%$rss_uuid%' "; }
  78. if (strlen($rss_category) > 0) { $sql .= "and rss_category like '%$rss_category%' "; }
  79. if (strlen($rss_sub_category) > 0) { $sql .= "and rss_sub_category like '%$rss_sub_category%' "; }
  80. if (strlen($rss_title) > 0) { $sql .= "and rss_title like '%$rss_title%' "; }
  81. if (strlen($rss_link) > 0) { $sql .= "and rss_link like '%$rss_link%' "; }
  82. if (strlen($rss_description) > 0) { $sql .= "and rss_description like '%$rss_description%' "; }
  83. if (strlen($rss_img) > 0) { $sql .= "and rss_img like '%$rss_img%' "; }
  84. if (strlen($rss_optional_1) > 0) { $sql .= "and rss_optional_1 like '%$rss_optional_1%' "; }
  85. if (strlen($rss_optional_2) > 0) { $sql .= "and rss_optional_2 like '%$rss_optional_2%' "; }
  86. if (strlen($rss_optional_3) > 0) { $sql .= "and rss_optional_3 like '%$rss_optional_3%' "; }
  87. if (strlen($rss_optional_4) > 0) { $sql .= "and rss_optional_4 like '%$rss_optional_4%' "; }
  88. if (strlen($rss_optional_5) > 0) { $sql .= "and rss_optional_5 like '%$rss_optional_5%' "; }
  89. if (strlen($rss_add_date) > 0) { $sql .= "and rss_add_date like '%$rss_add_date%' "; }
  90. if (strlen($rss_add_user) > 0) { $sql .= "and rss_add_user like '%$rss_add_user%' "; }
  91. $sql .= "and rss_del_date is null ";
  92. $sql = trim($sql);
  93. if (substr($sql, -5) == "where"){ $sql = substr($sql, 0, (strlen($sql)-5)); }
  94. if (substr($sql, -3) == " or"){ $sql = substr($sql, 0, (strlen($sql)-5)); }
  95. $sql = str_replace ("where and", "where", $sql);
  96. $sql = str_replace ("or and", "or", $sql);
  97. //echo $sql;
  98. $prep_statement = $db->prepare(check_sql($sql));
  99. $prep_statement->execute();
  100. $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
  101. $result_count = count($result);
  102. $c = 0;
  103. $row_style["0"] = "background-color: #F5F5DC;";
  104. $row_style["1"] = "background-color: #FFFFFF;";
  105. echo "<b>".$text['label-search']."</b><br>";
  106. echo "<div align='left'>\n";
  107. echo "<table border='0' cellpadding='1' cellspacing='1'>\n";
  108. echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>";
  109. if ($result_count == 0) { //no results
  110. echo "<tr><td>&nbsp;</td></tr>";
  111. }
  112. else { //received results
  113. echo "<tr>";
  114. echo "<th nowrap>&nbsp; &nbsp; ".$text['label-id']."&nbsp; &nbsp; </th>";
  115. echo "<th nowrap>&nbsp; &nbsp; ".$text['label-category']."&nbsp; &nbsp; </th>";
  116. echo "<th nowrap>&nbsp; &nbsp; ".$text['label-sub-category']."&nbsp; &nbsp; </th>";
  117. echo "<th nowrap>&nbsp; &nbsp; ".$text['label-title']."&nbsp; &nbsp; </th>";
  118. //echo "<th nowrap>&nbsp; &nbsp; rss_link&nbsp; &nbsp; </th>";
  119. //echo "<th nowrap>&nbsp; &nbsp; rss_description&nbsp; &nbsp; </th>";
  120. //echo "<th nowrap>&nbsp; &nbsp; rss_img&nbsp; &nbsp; </th>";
  121. //echo "<th nowrap>&nbsp; &nbsp; rss_optional_1&nbsp; &nbsp; </th>";
  122. //echo "<th nowrap>&nbsp; &nbsp; rss_optional_2&nbsp; &nbsp; </th>";
  123. //echo "<th nowrap>&nbsp; &nbsp; rss_optional_3&nbsp; &nbsp; </th>";
  124. //echo "<th nowrap>&nbsp; &nbsp; rss_optional_4&nbsp; &nbsp; </th>";
  125. //echo "<th nowrap>&nbsp; &nbsp; rss_optional_5&nbsp; &nbsp; </th>";
  126. //echo "<th nowrap>&nbsp; &nbsp; rss_add_date&nbsp; &nbsp; </th>";
  127. //echo "<th nowrap>&nbsp; &nbsp; rss_add_user&nbsp; &nbsp; </th>";
  128. echo "</tr>";
  129. echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>\n";
  130. foreach($result as $row) {
  131. //print_r( $row );
  132. echo "<tr style='".$row_style[$c]."'>\n";
  133. echo "<td valign='top'><a href='rssupdate.php?rss_uuid=".escape($row[rss_uuid])."'>".escape($row[rss_uuid])."</a></td>";
  134. echo "<td valign='top'>".escape($row[rss_category])."</td>";
  135. echo "<td valign='top'>".escape($row[rss_sub_category])."</td>";
  136. echo "<td valign='top'>".escape($row[rss_title])."</td>";
  137. //echo "<td valign='top'>".escape($row[rss_link])."</td>";
  138. //echo "<td valign='top'>".escape($row[rss_description])."</td>";
  139. //echo "<td valign='top'>".escape($row[rss_img])."</td>";
  140. //echo "<td valign='top'>".escape($row[rss_optional_1])."</td>";
  141. //echo "<td valign='top'>".escape($row[rss_optional_2])."</td>";
  142. //echo "<td valign='top'>".escape($row[rss_optional_3])."</td>";
  143. //echo "<td valign='top'>".escape($row[rss_optional_4])."</td>";
  144. //echo "<td valign='top'>".escape($row[rss_optional_5])."</td>";
  145. //echo "<td valign='top'>".escape($row[rss_add_date])."</td>";
  146. //echo "<td valign='top'>".escape($row[rss_add_user])."</td>";
  147. echo "</tr>";
  148. echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>\n";
  149. if ($c==0) { $c=1; } else { $c=0; }
  150. } //end foreach unset($sql, $result, $row_count);
  151. echo "</table>\n";
  152. echo "</div>\n";
  153. echo " <br><br>";
  154. echo " </td>\n";
  155. echo "</tr>\n";
  156. } //end if results
  157. echo "</table>\n";
  158. echo "</div>";
  159. echo "<br><br>";
  160. require_once "resources/footer.php";
  161. unset ($result_count);
  162. unset ($result);
  163. unset ($key);
  164. unset ($val);
  165. unset ($c);
  166. }
  167. else {
  168. echo "\n"; require_once "resources/header.php";
  169. echo "<div align='center'>";
  170. echo "<table border='0' cellpadding='0' cellspacing='2'>\n";
  171. echo "<tr class='border'>\n";
  172. echo " <td align=\"left\">\n";
  173. echo " <br>";
  174. echo "<form method='post' action=''>";
  175. echo "<table>";
  176. echo " <tr>";
  177. echo " <td>Id</td>";
  178. echo " <td><input type='text' class='txt' name='rss_uuid'></td>";
  179. echo " </tr>";
  180. echo " <tr>";
  181. echo " <td>".$text['label-category']."</td>";
  182. echo " <td><input type='text' class='txt' name='rss_category'></td>";
  183. echo " </tr>";
  184. //echo " <tr>";
  185. //echo " <td>rss_sub_category</td>";
  186. //echo " <td><input type='text' class='txt' name='rss_sub_category'></td>";
  187. //echo " </tr>";
  188. echo " <tr>";
  189. echo " <td>".$text['label-title']."</td>";
  190. echo " <td><input type='text' class='txt' name='rss_title'></td>";
  191. echo " </tr>";
  192. echo " <tr>";
  193. echo " <td>".$text['label-link']."</td>";
  194. echo " <td><input type='text' class='txt' name='rss_link'></td>";
  195. echo " </tr>";
  196. echo " <tr>";
  197. echo " <td>".$text['label-description']."</td>";
  198. echo " <td><input type='text' class='txt' name='rss_description'></td>";
  199. echo " </tr>";
  200. //echo " <tr>";
  201. //echo " <td>Image</td>";
  202. //echo " <td><input type='text' class='txt' name='rss_img'></td>";
  203. //echo " </tr>";
  204. //echo " <tr>";
  205. //echo " <td>rss_optional_1</td>";
  206. //echo " <td><input type='text' class='txt' name='rss_optional_1'></td>";
  207. //echo " </tr>";
  208. //echo " <tr>";
  209. //echo " <td>rss_optional_2</td>";
  210. //echo " <td><input type='text' class='txt' name='rss_optional_2'></td>";
  211. //echo " </tr>";
  212. //echo " <tr>";
  213. //echo " <td>rss_optional_3</td>";
  214. //echo " <td><input type='text' class='txt' name='rss_optional_3'></td>";
  215. //echo " </tr>";
  216. //echo " <tr>";
  217. //echo " <td>rss_optional_4</td>";
  218. //echo " <td><input type='text' class='txt' name='rss_optional_4'></td>";
  219. //echo " </tr>";
  220. //echo " <tr>";
  221. //echo " <td>rss_optional_5</td>";
  222. //echo " <td><input type='text' class='txt' name='rss_optional_5'></td>";
  223. //echo " </tr>";
  224. //echo " <tr>";
  225. //echo " <td>rss_add_date</td>";
  226. //echo " <td><input type='text' class='txt' name='rss_add_date'></td>";
  227. //echo " </tr>";
  228. //echo " <tr>";
  229. //echo " <td>rss_add_user</td>";
  230. //echo " <td><input type='text' class='txt' name='rss_add_user'></td>";
  231. //echo " </tr>";
  232. echo " <tr>";
  233. echo " <td colspan='2' align='right'><input type='submit' name='submit' class='btn' value='".$text['button-search']."'></td>";
  234. echo " </tr>";
  235. echo "</table>";
  236. echo "</form>";
  237. echo " </td>";
  238. echo " </tr>";
  239. echo "</table>";
  240. echo "</div>";
  241. require_once "resources/footer.php";
  242. } //end if not post
  243. ?>