rsssublist.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  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. $rss_uuid = $_GET["rss_uuid"];
  37. $order_by = $_GET["order_by"];
  38. $order = $_GET["order"];
  39. require_once "resources/header.php";
  40. echo "<div align='center'>";
  41. echo "<table width='500' border='0' cellpadding='0' cellspacing='2'>\n";
  42. echo "<tr class='border'>\n";
  43. echo " <td align=\"left\">\n";
  44. echo " <br>";
  45. echo " <b>$module_title ".$text['label-details']."</b>";
  46. $sql = "";
  47. $sql .= "select * from v_rss ";
  48. $sql .= "where domain_uuid = '$domain_uuid' ";
  49. $sql .= "and rss_uuid = '$rss_uuid' ";
  50. $sql .= "and rss_category = '$rss_category' ";
  51. $sql .= "and length(rss_del_date) = 0 ";
  52. $sql .= "or domain_uuid = '$domain_uuid' ";
  53. $sql .= "and rss_uuid = '$rss_uuid' ";
  54. $sql .= "and rss_category = '$rss_category' ";
  55. $sql .= "and rss_del_date is null ";
  56. $sql .= "order by rss_uuid asc ";
  57. //echo $sql;
  58. $prep_statement = $db->prepare(check_sql($sql));
  59. $prep_statement->execute();
  60. $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
  61. $result_count = count($result);
  62. echo "<table border='0' width='100%'>";
  63. if ($result_count == 0) { //no results
  64. echo "<tr><td>&nbsp;</td></tr>";
  65. }
  66. else { //received results
  67. foreach($result as $row) {
  68. //print_r( $row );
  69. //echo "<tr style='".$row_style[$c]."'>\n";
  70. //echo "<tr>";
  71. //echo " <td valign='top'>Title</td>";
  72. //echo " <td valign='top'><a href='rssupdate.php?rss_uuid=".escape($row[rss_uuid])."'>".escape($row[rss_uuid])."</a></td>";
  73. //echo "</tr>";
  74. //echo "<td valign='top'>".$row[rss_category]."</td>";
  75. echo "<tr>";
  76. echo " <td valign='top'>".$text['label-title'].": &nbsp;</td>";
  77. echo " <td valign='top'><b>".escape($row[rss_title])."</b></td>";
  78. echo " <td valign='top' align='right'>";
  79. echo " <input type='button' class='btn' name='' onclick=\"window.location='rssupdate.php?rss_uuid=".escape($row[rss_uuid])."'\" value='".$text['button-update']."'>";
  80. echo " </td>";
  81. $rss_description = $row[rss_description];
  82. //$rss_description = str_replace ("\r\n", "<br>", $rss_description);
  83. //$rss_description = str_replace ("\n", "<br>", $rss_description);
  84. echo "</tr>";
  85. echo "<tr>";
  86. echo " <td valign='top'>".$text['label-template'].": &nbsp;</td>";
  87. echo " <td valign='top'>".escape($row[rss_sub_category])."</td>";
  88. echo "</tr>";
  89. echo "<tr>";
  90. echo " <td valign='top'>".$text['label-group'].": &nbsp;</td>";
  91. echo " <td valign='top'>".escape($row[rss_group])."</td>";
  92. echo "</tr>";
  93. if (strlen($row[rss_order]) > 0) {
  94. echo "<tr>";
  95. echo " <td valign='top'>".$text['label-order'].": &nbsp;</td>";
  96. echo " <td valign='top'>".escape($row[rss_order])."</td>";
  97. echo "</tr>";
  98. }
  99. //echo "<td valign='top'>".$row[rss_link]."</td>";
  100. echo " <td valign='top'>".$text['label-description'].": &nbsp;</td>";
  101. echo " <td valign='top' colspan='2'>".escape($rss_description)."</td>";
  102. //echo "<td valign='top'>".$row[rss_img]."</td>";
  103. //echo "<tr>";
  104. //echo " <td valign='top'>Priority: &nbsp;</td>";
  105. //echo " <td valign='top' colspan='2'>".escape($row[rss_optional_1])."</td>"; //priority
  106. //echo "</tr>";
  107. //echo "<tr>";
  108. //echo " <td valign='top'>Status: &nbsp;</td>"; //completion status
  109. //echo " <td valign='top' colspan='2'>";
  110. //echo $row[rss_optional_2];
  111. //if ($row[rss_optional_2]=="100") {
  112. // echo "Complete";
  113. //}
  114. //else {
  115. // echo $row[rss_optional_2]."%";
  116. //}
  117. //echo "</td>"; //completion status
  118. //echo "<td valign='top'>".escape($row[rss_optional_3])."</td>";
  119. //echo "<td valign='top'>".escape($row[rss_optional_4])."</td>";
  120. //echo "<td valign='top'>".escape($row[rss_optional_5])."</td>";
  121. //echo "<td valign='top'>".escape($row[rss_add_date])."</td>";
  122. //echo "<td valign='top'>".escape($row[rss_add_user])."</td>";
  123. //echo "<tr>";
  124. //echo " <td valign='top'>";
  125. //echo " <a href='rsssublist.php?rss_uuid=".$row[rss_uuid]."'>Details</a>";
  126. //echo " <input type='button' class='btn' name='' onclick=\"window.location='rsssublist.php?rss_uuid=".escape($row[rss_uuid])."'\" value='Details'>";
  127. //echo " </td>";
  128. //echo "</tr>";
  129. echo "</tr>";
  130. //echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>\n";
  131. if ($c==0) { $c=1; } else { $c=0; }
  132. } //end foreach
  133. }
  134. echo "</table>";
  135. unset($sql, $prep_statement, $result);
  136. if ($rss_sub_show == 1) {
  137. echo "<br><br><br>";
  138. echo "<b>$rss_sub_title</b><br>";
  139. $sql = "";
  140. $sql .= "select * from v_rss_sub ";
  141. $sql .= "where domain_uuid = '$domain_uuid' ";
  142. $sql .= "and rss_uuid = '$rss_uuid' ";
  143. $sql .= "and length(rss_sub_del_date) = 0 ";
  144. $sql .= "or domain_uuid = '$domain_uuid' ";
  145. $sql .= "and rss_uuid = '$rss_uuid' ";
  146. $sql .= "and rss_sub_del_date is null ";
  147. if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
  148. //echo $sql;
  149. $prep_statement = $db->prepare(check_sql($sql));
  150. $prep_statement->execute();
  151. $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
  152. $result_count = count($result);
  153. $c = 0;
  154. $row_style["0"] = "background-color: #F5F5DC;";
  155. $row_style["1"] = "background-color: #FFFFFF;";
  156. echo "<div align='left'>\n";
  157. echo "<table width='100%' border='0' cellpadding='1' cellspacing='1'>\n";
  158. //echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>";
  159. if ($result_count == 0) { //no results
  160. echo "<tr><td>&nbsp;</td></tr>";
  161. }
  162. else { //received results
  163. echo "<tr>";
  164. /*
  165. echo "<th nowrap>&nbsp; &nbsp; ";
  166. if (strlen($order_by)==0) {
  167. echo "<a href='?order_by=rss_sub_uuid&order=desc' title='ascending'>rss_sub_uuid</a>";
  168. }
  169. else {
  170. if ($order=="asc") {
  171. echo "<a href='?order_by=rss_sub_uuid&order=desc' title='ascending'>rss_sub_uuid</a>";
  172. }
  173. else {
  174. echo "<a href='?order_by=rss_sub_uuid&order=asc' title='descending'>rss_sub_uuid</a>";
  175. }
  176. }
  177. echo "&nbsp; &nbsp; </th>";
  178. echo "<th nowrap>&nbsp; &nbsp; ";
  179. if (strlen($order_by)==0) {
  180. echo "<a href='?order_by=rss_uuid&order=desc' title='ascending'>rss_uuid</a>";
  181. }
  182. else {
  183. if ($order=="asc") {
  184. echo "<a href='?order_by=rss_uuid&order=desc' title='ascending'>rss_uuid</a>";
  185. }
  186. else {
  187. echo "<a href='?order_by=rss_uuid&order=asc' title='descending'>rss_uuid</a>";
  188. }
  189. }
  190. echo "&nbsp; &nbsp; </th>";
  191. echo "<th nowrap>&nbsp; &nbsp; ";
  192. if (strlen($order_by)==0) {
  193. echo "<a href='?order_by=rss_sub_title&order=desc' title='ascending'>rss_sub_title</a>";
  194. }
  195. else {
  196. if ($order=="asc") {
  197. echo "<a href='?order_by=rss_sub_title&order=desc' title='ascending'>rss_sub_title</a>";
  198. }
  199. else {
  200. echo "<a href='?order_by=rss_sub_title&order=asc' title='descending'>rss_sub_title</a>";
  201. }
  202. }
  203. echo "&nbsp; &nbsp; </th>";
  204. echo "<th nowrap>&nbsp; &nbsp; ";
  205. if (strlen($order_by)==0) {
  206. echo "<a href='?order_by=rss_sub_link&order=desc' title='ascending'>rss_sub_link</a>";
  207. }
  208. else {
  209. if ($order=="asc") {
  210. echo "<a href='?order_by=rss_sub_link&order=desc' title='ascending'>rss_sub_link</a>";
  211. }
  212. else {
  213. echo "<a href='?order_by=rss_sub_link&order=asc' title='descending'>rss_sub_link</a>";
  214. }
  215. }
  216. echo "&nbsp; &nbsp; </th>";
  217. echo "<th nowrap>&nbsp; &nbsp; ";
  218. if (strlen($order_by)==0) {
  219. echo "<a href='?order_by=rss_sub_description&order=desc' title='ascending'>rss_sub_description</a>";
  220. }
  221. else {
  222. if ($order=="asc") {
  223. echo "<a href='?order_by=rss_sub_description&order=desc' title='ascending'>rss_sub_description</a>";
  224. }
  225. else {
  226. echo "<a href='?order_by=rss_sub_description&order=asc' title='descending'>rss_sub_description</a>";
  227. }
  228. }
  229. echo "&nbsp; &nbsp; </th>";
  230. echo "<th nowrap>&nbsp; &nbsp; ";
  231. if (strlen($order_by)==0) {
  232. echo "<a href='?order_by=rss_sub_optional_1&order=desc' title='ascending'>rss_sub_optional_1</a>";
  233. }
  234. else {
  235. if ($order=="asc") {
  236. echo "<a href='?order_by=rss_sub_optional_1&order=desc' title='ascending'>rss_sub_optional_1</a>";
  237. }
  238. else {
  239. echo "<a href='?order_by=rss_sub_optional_1&order=asc' title='descending'>rss_sub_optional_1</a>";
  240. }
  241. }
  242. echo "&nbsp; &nbsp; </th>";
  243. echo "<th nowrap>&nbsp; &nbsp; ";
  244. if (strlen($order_by)==0) {
  245. echo "<a href='?order_by=rss_sub_optional_2&order=desc' title='ascending'>rss_sub_optional_2</a>";
  246. }
  247. else {
  248. if ($order=="asc") {
  249. echo "<a href='?order_by=rss_sub_optional_2&order=desc' title='ascending'>rss_sub_optional_2</a>";
  250. }
  251. else {
  252. echo "<a href='?order_by=rss_sub_optional_2&order=asc' title='descending'>rss_sub_optional_2</a>";
  253. }
  254. }
  255. echo "&nbsp; &nbsp; </th>";
  256. echo "<th nowrap>&nbsp; &nbsp; ";
  257. if (strlen($order_by)==0) {
  258. echo "<a href='?order_by=rss_sub_optional_3&order=desc' title='ascending'>rss_sub_optional_3</a>";
  259. }
  260. else {
  261. if ($order=="asc") {
  262. echo "<a href='?order_by=rss_sub_optional_3&order=desc' title='ascending'>rss_sub_optional_3</a>";
  263. }
  264. else {
  265. echo "<a href='?order_by=rss_sub_optional_3&order=asc' title='descending'>rss_sub_optional_3</a>";
  266. }
  267. }
  268. echo "&nbsp; &nbsp; </th>";
  269. echo "<th nowrap>&nbsp; &nbsp; ";
  270. if (strlen($order_by)==0) {
  271. echo "<a href='?order_by=rss_sub_optional_4&order=desc' title='ascending'>rss_sub_optional_4</a>";
  272. }
  273. else {
  274. if ($order=="asc") {
  275. echo "<a href='?order_by=rss_sub_optional_4&order=desc' title='ascending'>rss_sub_optional_4</a>";
  276. }
  277. else {
  278. echo "<a href='?order_by=rss_sub_optional_4&order=asc' title='descending'>rss_sub_optional_4</a>";
  279. }
  280. }
  281. echo "&nbsp; &nbsp; </th>";
  282. echo "<th nowrap>&nbsp; &nbsp; ";
  283. if (strlen($order_by)==0) {
  284. echo "<a href='?order_by=rss_sub_optional_5&order=desc' title='ascending'>rss_sub_optional_5</a>";
  285. }
  286. else {
  287. if ($order=="asc") {
  288. echo "<a href='?order_by=rss_sub_optional_5&order=desc' title='ascending'>rss_sub_optional_5</a>";
  289. }
  290. else {
  291. echo "<a href='?order_by=rss_sub_optional_5&order=asc' title='descending'>rss_sub_optional_5</a>";
  292. }
  293. }
  294. echo "&nbsp; &nbsp; </th>";
  295. echo "<th nowrap>&nbsp; &nbsp; ";
  296. if (strlen($order_by)==0) {
  297. echo "<a href='?order_by=rss_sub_add_date&order=desc' title='ascending'>rss_sub_add_date</a>";
  298. }
  299. else {
  300. if ($order=="asc") {
  301. echo "<a href='?order_by=rss_sub_add_date&order=desc' title='ascending'>rss_sub_add_date</a>";
  302. }
  303. else {
  304. echo "<a href='?order_by=rss_sub_add_date&order=asc' title='descending'>rss_sub_add_date</a>";
  305. }
  306. }
  307. echo "&nbsp; &nbsp; </th>";
  308. echo "<th nowrap>&nbsp; &nbsp; ";
  309. if (strlen($order_by)==0) {
  310. echo "<a href='?order_by=rss_sub_add_user&order=desc' title='ascending'>rss_sub_add_user</a>";
  311. }
  312. else {
  313. if ($order=="asc") {
  314. echo "<a href='?order_by=rss_sub_add_user&order=desc' title='ascending'>rss_sub_add_user</a>";
  315. }
  316. else {
  317. echo "<a href='?order_by=rss_sub_add_user&order=asc' title='descending'>rss_sub_add_user</a>";
  318. }
  319. }
  320. echo "&nbsp; &nbsp; </th>";
  321. */
  322. echo "</tr>";
  323. echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>\n";
  324. foreach($result as $row) {
  325. //print_r( $row );
  326. echo "<tr style='".$row_style[$c]."'>\n";
  327. //echo "<td valign='top'>".$rss_uuid."</td>";
  328. //echo "<td valign='top'>&nbsp;<b>".$row[rss_sub_title]."</b>&nbsp;</td>";
  329. //echo "<td valign='top'>&nbsp;".$row[rss_sub_link]."&nbsp;</td>";
  330. echo "<td valign='top' width='200'>";
  331. echo " <b>".escape($row[rss_sub_title])."</b>";
  332. echo "</td>";
  333. echo "<td valign='top'>".escape($row[rss_sub_add_date])."</td>";
  334. //echo "<td valign='top'>".escape($row[rss_sub_optional_1])."</td>";
  335. //echo "<td valign='top'>".escape($row[rss_sub_optional_2])."</td>";
  336. //echo "<td valign='top'>".escape($row[rss_sub_optional_3])."</td>";
  337. //echo "<td valign='top'>".escape($row[rss_sub_optional_4])."</td>";
  338. //echo "<td valign='top'>".escape($row[rss_sub_optional_5])."</td>";
  339. //echo "<td valign='top'>".escape($row[rss_sub_add_user])."</td>";
  340. echo "<td valign='top'>";
  341. echo " <input type='button' class='btn' name='' onclick=\"if (confirm('".$text['message-confirm-delete']."')) { window.location='rsssubdelete.php?rss_uuid=".escape($row[rss_uuid])."&rss_sub_uuid=".escape($row[rss_sub_uuid])."' }\" value='".$text['button-delete']."'>";
  342. echo "</td>";
  343. echo "<td valign='top' align='right'>";
  344. echo " &nbsp;";
  345. echo " <input type='button' class='btn' name='' onclick=\"window.location='rsssubupdate.php?rss_uuid=".escape($rss_uuid)."&rss_sub_uuid=".escape($row[rss_sub_uuid])."'\" value='".$text['button-update']."'>";
  346. echo " &nbsp; \n";
  347. //echo " <a href='rsssubupdate.php?rss_uuid=".$rss_uuid."&rss_sub_uuid=".$row[rss_sub_uuid]."'>Update</a>&nbsp;";
  348. echo "</td>";
  349. $rss_sub_description = $row[rss_sub_description];
  350. $rss_sub_description = str_replace ("\r\n", "<br>", $rss_sub_description);
  351. $rss_sub_description = str_replace ("\n", "<br>", $rss_sub_description);
  352. echo "</tr>";
  353. echo "<tr style='".$row_style[$c]."'>\n";
  354. echo "<td valign='top' width='300' colspan='4'>";
  355. echo "".escape($rss_sub_description)."&nbsp;";
  356. echo "</td>";
  357. echo "</tr>";
  358. echo "</tr>";
  359. echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>\n";
  360. if ($c==0) { $c=1; } else { $c=0; }
  361. } //end foreach unset($sql, $result, $row_count);
  362. } //end if results
  363. echo "</table>\n";
  364. echo "</div>\n";
  365. } //if ($showrsssub == 1) {
  366. echo " <br><br>";
  367. echo " </td>\n";
  368. echo "</tr>\n";
  369. echo "</table>\n";
  370. //echo "<input type='button' class='btn' name='' onclick=\"window.location='rsssubsearch.php'\" value='Search'>&nbsp; &nbsp;\n";
  371. if ($rss_sub_show == 1) {
  372. echo "<input type='button' class='btn' name='' onclick=\"window.location='rsssubadd.php?rss_uuid=".escape($rss_uuid)."'\" value='".$text['button-add-title']." ".escape($rss_sub_title)."'>&nbsp; &nbsp;\n";
  373. }
  374. echo "</div>";
  375. echo "<br><br>";
  376. require_once "resources/footer.php";
  377. unset ($result_count);
  378. unset ($result);
  379. unset ($key);
  380. unset ($val);
  381. unset ($c);
  382. ?>