]>
Commit | Line | Data |
---|---|---|
ef8be8ea AD |
1 | <?php |
2 | function module_pref_filters($link) { | |
b4e75b2a AD |
3 | $subop = $_REQUEST["subop"]; |
4 | $quiet = $_REQUEST["quiet"]; | |
ef8be8ea AD |
5 | |
6 | if ($subop == "edit") { | |
7 | ||
b4e75b2a | 8 | $filter_id = db_escape_string($_REQUEST["id"]); |
ef8be8ea AD |
9 | |
10 | $result = db_query($link, | |
11 | "SELECT * FROM ttrss_filters WHERE id = '$filter_id' AND owner_uid = " . $_SESSION["uid"]); | |
12 | ||
47439031 | 13 | $reg_exp = htmlspecialchars(db_fetch_result($result, 0, "reg_exp")); |
ef8be8ea AD |
14 | $filter_type = db_fetch_result($result, 0, "filter_type"); |
15 | $feed_id = db_fetch_result($result, 0, "feed_id"); | |
16 | $action_id = db_fetch_result($result, 0, "action_id"); | |
073ca0e6 | 17 | $action_param = db_fetch_result($result, 0, "action_param"); |
44d0e774 | 18 | $filter_param = db_fetch_result($result, 0, "filter_param"); |
ef8be8ea AD |
19 | |
20 | $enabled = sql_bool_to_bool(db_fetch_result($result, 0, "enabled")); | |
3f2ff803 | 21 | $inverse = sql_bool_to_bool(db_fetch_result($result, 0, "inverse")); |
ef8be8ea | 22 | |
ecace165 | 23 | print "<div id=\"infoBoxTitle\">".__('Filter Editor')."</div>"; |
ef8be8ea AD |
24 | print "<div class=\"infoBoxContents\">"; |
25 | ||
e6312f6c | 26 | print "<form id=\"filter_edit_form\" onsubmit='return false'>"; |
ef8be8ea AD |
27 | |
28 | print "<input type=\"hidden\" name=\"op\" value=\"pref-filters\">"; | |
29 | print "<input type=\"hidden\" name=\"id\" value=\"$filter_id\">"; | |
30 | print "<input type=\"hidden\" name=\"subop\" value=\"editSave\">"; | |
ef8be8ea AD |
31 | |
32 | $result = db_query($link, "SELECT id,description | |
33 | FROM ttrss_filter_types ORDER BY description"); | |
34 | ||
35 | $filter_types = array(); | |
36 | ||
37 | while ($line = db_fetch_assoc($result)) { | |
38 | //array_push($filter_types, $line["description"]); | |
89cb787e | 39 | $filter_types[$line["id"]] = __($line["description"]); |
ef8be8ea AD |
40 | } |
41 | ||
10fa6615 AD |
42 | print "<div class=\"dlgSec\">".__("Match")."</div>"; |
43 | ||
44 | print "<div class=\"dlgSecCont\">"; | |
45 | ||
6e278744 | 46 | if ($filter_type != 5) { |
df00fb80 | 47 | $date_ops_invisible = 'style="display : none"'; |
6e278744 AD |
48 | } |
49 | ||
50 | print "<span id=\"filter_dlg_date_mod_box\" $date_ops_invisible>"; | |
51 | print __("Date") . " "; | |
44d0e774 AD |
52 | |
53 | $filter_params = array( | |
54 | "before" => __("before"), | |
55 | "after" => __("after")); | |
56 | ||
57 | print_select_hash("filter_date_modifier", $filter_param, | |
58 | $filter_params); | |
59 | ||
60 | print " </span>"; | |
6e278744 | 61 | |
10fa6615 | 62 | print "<input onkeypress=\"return filterCR(event, filterEditSave)\" |
10fa6615 AD |
63 | name=\"reg_exp\" size=\"30\" value=\"$reg_exp\">"; |
64 | ||
6e278744 AD |
65 | print "<span id=\"filter_dlg_date_chk_box\" $date_ops_invisible>"; |
66 | print " <input class=\"button\" | |
67 | type=\"submit\" onclick=\"return filterDlgCheckDate()\" | |
68 | value=\"".__('Check it')."\">"; | |
69 | print "</span>"; | |
70 | ||
71 | print "<br/> " . __("on field") . " "; | |
72 | print_select_hash("filter_type", $filter_type, $filter_types, | |
73 | 'onchange="filterDlgCheckType(this)"'); | |
10fa6615 AD |
74 | |
75 | print "<br/>"; | |
76 | ||
77 | print __("in") . " "; | |
78 | print_feed_select($link, "feed_id", $feed_id); | |
79 | ||
80 | print "</div>"; | |
81 | ||
ecace165 | 82 | print "<div class=\"dlgSec\">".__("Perform Action")."</div>"; |
10fa6615 AD |
83 | |
84 | print "<div class=\"dlgSecCont\">"; | |
85 | ||
86 | print "<select name=\"action_id\" | |
87 | onchange=\"filterDlgCheckAction(this)\">"; | |
88 | ||
89 | $result = db_query($link, "SELECT id,description FROM ttrss_filter_actions | |
90 | ORDER BY name"); | |
91 | ||
92 | while ($line = db_fetch_assoc($result)) { | |
93 | $is_sel = ($line["id"] == $action_id) ? "selected" : ""; | |
94 | printf("<option value='%d' $is_sel>%s</option>", $line["id"], __($line["description"])); | |
95 | } | |
96 | ||
97 | print "</select>"; | |
98 | ||
ceb30ba4 | 99 | $param_hidden = ($action_id == 4 || $action_id == 6 || $action_id == 7) ? "" : "display : none"; |
10fa6615 | 100 | |
143a4973 AD |
101 | print "<span id=\"filter_dlg_param_box\" style=\"$param_hidden\">"; |
102 | print " " . __("with parameters:") . " "; | |
ceb30ba4 AD |
103 | |
104 | $param_int_hidden = ($action_id != 7) ? "" : "display : none"; | |
105 | ||
106 | print "<input size=\"20\" style=\"$param_int_hidden\" | |
074bf20c | 107 | onkeypress=\"return filterCR(event, filterEditSave)\" |
143a4973 | 108 | name=\"action_param\" value=\"$action_param\">"; |
ceb30ba4 AD |
109 | |
110 | $param_int_hidden = ($action_id == 7) ? "" : "display : none"; | |
111 | ||
112 | print_label_select($link, "action_param_label", $action_param, | |
113 | $param_int_hidden); | |
114 | ||
143a4973 | 115 | print "</span>"; |
10fa6615 | 116 | |
143a4973 | 117 | print " "; // tiny layout hack |
10fa6615 AD |
118 | |
119 | print "</div>"; | |
120 | ||
121 | print "<div class=\"dlgSec\">".__("Options")."</div>"; | |
122 | print "<div class=\"dlgSecCont\">"; | |
123 | ||
ecace165 AD |
124 | print "<div style=\"line-height : 100%\">"; |
125 | ||
10fa6615 AD |
126 | if ($enabled) { |
127 | $checked = "checked"; | |
128 | } else { | |
129 | $checked = ""; | |
130 | } | |
131 | ||
132 | print "<input type=\"checkbox\" name=\"enabled\" id=\"enabled\" $checked> | |
133 | <label for=\"enabled\">".__('Enabled')."</label><br/>"; | |
134 | ||
135 | if ($inverse) { | |
136 | $checked = "checked"; | |
137 | } else { | |
138 | $checked = ""; | |
139 | } | |
140 | ||
141 | print "<input type=\"checkbox\" name=\"inverse\" id=\"inverse\" $checked> | |
142 | <label for=\"inverse\">".__('Inverse match')."</label>"; | |
143 | ||
144 | print "</div>"; | |
ecace165 | 145 | print "</div>"; |
10fa6615 AD |
146 | |
147 | print "<div class=\"dlgButtons\">"; | |
ef8be8ea | 148 | |
ddb61e79 | 149 | $reg_exp = htmlspecialchars($reg_exp, ENT_QUOTES); // second escaping seems to be needed for javascript |
143a4973 AD |
150 | |
151 | print "<div style=\"float : left\">"; | |
577399e8 AD |
152 | print "<button onclick='return removeFilter($filter_id, \"$reg_exp\")'>". |
153 | __('Remove')."</button>"; | |
143a4973 AD |
154 | print "</div>"; |
155 | ||
577399e8 AD |
156 | print "<button onclick=\"return filterEditSave()\">". |
157 | __('Save')."</button> "; | |
ef8be8ea | 158 | |
577399e8 AD |
159 | print "<button onclick=\"return filterEditCancel()\">". |
160 | __('Cancel')."</button>"; | |
ef8be8ea AD |
161 | |
162 | print "</div>"; | |
163 | ||
164 | return; | |
165 | } | |
166 | ||
167 | ||
168 | if ($subop == "editSave") { | |
169 | ||
b4e75b2a AD |
170 | $reg_exp = db_escape_string(trim($_REQUEST["reg_exp"])); |
171 | $filter_type = db_escape_string(trim($_REQUEST["filter_type"])); | |
172 | $filter_id = db_escape_string($_REQUEST["id"]); | |
173 | $feed_id = db_escape_string($_REQUEST["feed_id"]); | |
174 | $action_id = db_escape_string($_REQUEST["action_id"]); | |
175 | $action_param = db_escape_string($_REQUEST["action_param"]); | |
176 | $action_param_label = db_escape_string($_REQUEST["action_param_label"]); | |
177 | $enabled = checkbox_to_sql_bool(db_escape_string($_REQUEST["enabled"])); | |
178 | $inverse = checkbox_to_sql_bool(db_escape_string($_REQUEST["inverse"])); | |
ef8be8ea | 179 | |
44d0e774 | 180 | # for the time being, no other filters use params anyway... |
b4e75b2a | 181 | $filter_param = db_escape_string($_REQUEST["filter_date_modifier"]); |
44d0e774 | 182 | |
ef8be8ea AD |
183 | if (!$feed_id) { |
184 | $feed_id = 'NULL'; | |
185 | } else { | |
186 | $feed_id = sprintf("'%s'", db_escape_string($feed_id)); | |
187 | } | |
ceb30ba4 AD |
188 | |
189 | /* When processing 'assign label' filters, action_param_label dropbox | |
190 | * overrides action_param */ | |
191 | ||
192 | if ($action_id == 7) { | |
193 | $action_param = $action_param_label; | |
194 | } | |
195 | ||
ef8be8ea AD |
196 | $result = db_query($link, "UPDATE ttrss_filters SET |
197 | reg_exp = '$reg_exp', | |
198 | feed_id = $feed_id, | |
199 | action_id = '$action_id', | |
200 | filter_type = '$filter_type', | |
073ca0e6 | 201 | enabled = $enabled, |
3f2ff803 | 202 | inverse = $inverse, |
44d0e774 AD |
203 | action_param = '$action_param', |
204 | filter_param = '$filter_param' | |
4dccf1ed | 205 | WHERE id = '$filter_id' AND owner_uid = " . $_SESSION["uid"]); |
5e6f933a AD |
206 | |
207 | if (db_affected_rows($link, $result) != 0) { | |
208 | print_notice(T_sprintf("Saved filter <b>%s</b>", htmlspecialchars($reg_exp))); | |
209 | } | |
210 | ||
ef8be8ea AD |
211 | } |
212 | ||
213 | if ($subop == "remove") { | |
214 | ||
b4e75b2a | 215 | $ids = split(",", db_escape_string($_REQUEST["ids"])); |
ef8be8ea | 216 | |
4dccf1ed AD |
217 | foreach ($ids as $id) { |
218 | db_query($link, "DELETE FROM ttrss_filters WHERE id = '$id' AND owner_uid = ". $_SESSION["uid"]); | |
ef8be8ea AD |
219 | } |
220 | } | |
221 | ||
222 | if ($subop == "add") { | |
223 | ||
b4e75b2a AD |
224 | $regexp = db_escape_string(trim($_REQUEST["reg_exp"])); |
225 | $filter_type = db_escape_string(trim($_REQUEST["filter_type"])); | |
226 | $feed_id = db_escape_string($_REQUEST["feed_id"]); | |
227 | $action_id = db_escape_string($_REQUEST["action_id"]); | |
228 | $action_param = db_escape_string($_REQUEST["action_param"]); | |
229 | $action_param_label = db_escape_string($_REQUEST["action_param_label"]); | |
230 | $inverse = checkbox_to_sql_bool(db_escape_string($_REQUEST["inverse"])); | |
4dccf1ed | 231 | |
44d0e774 | 232 | # for the time being, no other filters use params anyway... |
b4e75b2a | 233 | $filter_param = db_escape_string($_REQUEST["filter_date_modifier"]); |
44d0e774 | 234 | |
4dccf1ed AD |
235 | if (!$regexp) return; |
236 | ||
237 | if (!$feed_id) { | |
238 | $feed_id = 'NULL'; | |
239 | } else { | |
240 | $feed_id = sprintf("'%s'", db_escape_string($feed_id)); | |
241 | } | |
242 | ||
db34a63e AD |
243 | /* When processing 'assign label' filters, action_param_label dropbox |
244 | * overrides action_param */ | |
245 | ||
246 | if ($action_id == 7) { | |
247 | $action_param = $action_param_label; | |
248 | } | |
249 | ||
4dccf1ed AD |
250 | $result = db_query($link, |
251 | "INSERT INTO ttrss_filters (reg_exp,filter_type,owner_uid,feed_id, | |
a8732d0c | 252 | action_id, action_param, inverse, filter_param) |
4dccf1ed AD |
253 | VALUES |
254 | ('$regexp', '$filter_type','".$_SESSION["uid"]."', | |
a8732d0c | 255 | $feed_id, '$action_id', '$action_param', $inverse, '$filter_param')"); |
4dccf1ed | 256 | |
5e6f933a AD |
257 | if (db_affected_rows($link, $result) != 0) { |
258 | print T_sprintf("Created filter <b>%s</b>", htmlspecialchars($regexp)); | |
259 | } | |
260 | ||
261 | return; | |
ef8be8ea AD |
262 | } |
263 | ||
264 | if ($quiet) return; | |
265 | ||
fe8d2059 AD |
266 | set_pref($link, "_PREFS_ACTIVE_TAB", "filterConfig"); |
267 | ||
b4e75b2a | 268 | $sort = db_escape_string($_REQUEST["sort"]); |
ef8be8ea AD |
269 | |
270 | if (!$sort || $sort == "undefined") { | |
271 | $sort = "reg_exp"; | |
272 | } | |
273 | ||
274 | // print "<div id=\"infoBoxShadow\"><div id=\"infoBox\">PLACEHOLDER</div></div>"; | |
275 | ||
276 | $result = db_query($link, "SELECT id,description | |
277 | FROM ttrss_filter_types ORDER BY description"); | |
278 | ||
279 | $filter_types = array(); | |
280 | ||
281 | while ($line = db_fetch_assoc($result)) { | |
282 | //array_push($filter_types, $line["description"]); | |
283 | $filter_types[$line["id"]] = $line["description"]; | |
284 | } | |
285 | ||
9c87d75c | 286 | |
b4e75b2a | 287 | $filter_search = db_escape_string($_REQUEST["search"]); |
9c87d75c | 288 | |
b4e75b2a | 289 | if (array_key_exists("search", $_REQUEST)) { |
9c87d75c AD |
290 | $_SESSION["prefs_filter_search"] = $filter_search; |
291 | } else { | |
292 | $filter_search = $_SESSION["prefs_filter_search"]; | |
293 | } | |
294 | ||
577399e8 | 295 | print "<div style='float : right'> |
9c87d75c | 296 | <input id=\"filter_search\" size=\"20\" type=\"search\" |
4cf6fc6a AD |
297 | onfocus=\"javascript:disableHotkeys();\" |
298 | onblur=\"javascript:enableHotkeys();\" | |
9c87d75c | 299 | onchange=\"javascript:updateFilterList()\" value=\"$filter_search\"> |
577399e8 | 300 | <button onclick=\"javascript:updateFilterList()\">".__('Search')."</button> |
1e5548db AD |
301 | |
302 | <a class='helpLinkPic' href=\"javascript:displayHelpInfobox(2)\"> | |
883fee8d | 303 | <img style='vertical-align : top;' src='".theme_image($link, "images/sign_quest.png")."'></a> |
577399e8 | 304 | </div>"; |
9c87d75c | 305 | |
577399e8 AD |
306 | print "<button onclick=\"return displayDlg('quickAddFilter', false)\">". |
307 | __('Create filter')."</button> "; | |
0d32b41e | 308 | |
577399e8 AD |
309 | print "<button onclick=\"return editSelectedFilter()\">". |
310 | __('Edit')."</button> "; | |
ef8be8ea | 311 | |
577399e8 AD |
312 | print "<button onclick=\"return removeSelectedFilters()\">". |
313 | __('Remove')."</button> "; | |
1e5548db | 314 | |
577399e8 AD |
315 | print "<button onclick=\"rescore_all_feeds()\">". |
316 | __('Rescore articles')."</button> "; | |
95a948a5 | 317 | |
9c87d75c | 318 | if ($filter_search) { |
1638fc4e AD |
319 | $filter_search = split(' ', db_escape_string($filter_search)); |
320 | ||
321 | $tokens = array(); | |
322 | ||
323 | foreach ($filter_search as $token) { | |
324 | $token = trim($token); | |
325 | ||
326 | array_push($tokens, "( | |
327 | UPPER(ttrss_filter_actions.description) LIKE UPPER('%$token%') OR | |
328 | UPPER(reg_exp) LIKE UPPER('%$token%') OR | |
329 | UPPER(action_param) LIKE UPPER('%$token%') OR | |
330 | UPPER(ttrss_feeds.title) LIKE UPPER('%$token%') OR | |
331 | UPPER(ttrss_filter_types.description) LIKE UPPER('%$token%'))"); | |
332 | } | |
333 | ||
334 | $filter_search_query = "(" . join($tokens, " AND ") . ") AND "; | |
335 | ||
9c87d75c AD |
336 | } else { |
337 | $filter_search_query = ""; | |
338 | } | |
339 | ||
ef8be8ea AD |
340 | $result = db_query($link, "SELECT |
341 | ttrss_filters.id AS id,reg_exp, | |
342 | ttrss_filter_types.name AS filter_type_name, | |
343 | ttrss_filter_types.description AS filter_type_descr, | |
344 | enabled, | |
3f2ff803 | 345 | inverse, |
ef8be8ea | 346 | feed_id, |
7f94284b | 347 | filter_param, |
1b74062f | 348 | filter_type, |
ef8be8ea | 349 | ttrss_filter_actions.description AS action_description, |
ff6e357a AD |
350 | ttrss_feeds.title AS feed_title, |
351 | ttrss_filter_actions.name AS action_name, | |
352 | ttrss_filters.action_param AS action_param | |
ef8be8ea AD |
353 | FROM |
354 | ttrss_filter_types,ttrss_filter_actions,ttrss_filters LEFT JOIN | |
355 | ttrss_feeds ON (ttrss_filters.feed_id = ttrss_feeds.id) | |
356 | WHERE | |
357 | filter_type = ttrss_filter_types.id AND | |
9c87d75c | 358 | $filter_search_query |
ef8be8ea AD |
359 | ttrss_filter_actions.id = action_id AND |
360 | ttrss_filters.owner_uid = ".$_SESSION["uid"]." | |
a82dc5e4 | 361 | ORDER by action_description, $sort"); |
ef8be8ea AD |
362 | |
363 | if (db_num_rows($result) != 0) { | |
364 | ||
ef8be8ea AD |
365 | print "<p><table width=\"100%\" cellspacing=\"0\" class=\"prefFilterList\" |
366 | id=\"prefFilterList\">"; | |
367 | ||
368 | print "<tr><td class=\"selectPrompt\" colspan=\"8\"> | |
e8d0177d AD |
369 | ".__('Select:')." |
370 | <a href=\"javascript:selectPrefRows('filter', true)\">".__('All')."</a>, | |
371 | <a href=\"javascript:selectPrefRows('filter', false)\">".__('None')."</a> | |
ef8be8ea AD |
372 | </td</tr>"; |
373 | ||
ef8be8ea | 374 | $lnum = 0; |
a82dc5e4 AD |
375 | |
376 | $cur_action_description = ""; | |
377 | ||
ef8be8ea AD |
378 | while ($line = db_fetch_assoc($result)) { |
379 | ||
ef8be8ea | 380 | $filter_id = $line["id"]; |
b4e75b2a | 381 | $edit_filter_id = $_REQUEST["id"]; |
ef8be8ea AD |
382 | |
383 | $enabled = sql_bool_to_bool($line["enabled"]); | |
3f2ff803 AD |
384 | $inverse = sql_bool_to_bool($line["inverse"]); |
385 | ||
ef9cab23 | 386 | $this_row_id = "id=\"FILRR-$filter_id\""; |
a82dc5e4 AD |
387 | |
388 | $line["filter_type_descr"] = __($line["filter_type_descr"]); | |
389 | $line["action_description"] = __($line["action_description"]); | |
390 | ||
391 | if ($line["action_description"] != $cur_action_description) { | |
392 | $cur_action_description = $line["action_description"]; | |
393 | ||
394 | print "<tr><td class='filterEditCat' colspan='6'>$cur_action_description</td></tr>"; | |
395 | ||
396 | print "<tr class=\"title\"> | |
397 | <td align='center' width=\"5%\"> </td> | |
defaccde | 398 | <td width=\"20%\"><a href=\"javascript:updateFilterList('reg_exp')\">".__('Match')."</a></td> |
a82dc5e4 | 399 | <td width=\"\"><a href=\"javascript:updateFilterList('feed_title')\">".__('Feed')."</a></td> |
defaccde | 400 | <td width=\"20%\"><a href=\"javascript:updateFilterList('filter_type')\">".__('Field')."</a></td> |
08e618f7 | 401 | <td width=\"20%\"><a href=\"javascript:updateFilterList('action_param')\">".__('Params')."</a></td>"; |
a82dc5e4 | 402 | |
ef9cab23 | 403 | $lnum = 0; |
a82dc5e4 AD |
404 | } |
405 | ||
ef9cab23 AD |
406 | $class = ($lnum % 2) ? "even" : "odd"; |
407 | ||
ef8be8ea AD |
408 | print "<tr class=\"$class\" $this_row_id>"; |
409 | ||
47439031 | 410 | $line["reg_exp"] = htmlspecialchars($line["reg_exp"]); |
ef8be8ea | 411 | |
a3c159c4 | 412 | if (!$line["feed_title"]) $line["feed_title"] = __("All feeds"); |
0966ea37 AD |
413 | |
414 | if (!$line["action_param"]) { | |
08e618f7 | 415 | $line["action_param"] = "—"; |
0966ea37 AD |
416 | } else if ($line["action_name"] == "score") { |
417 | ||
883fee8d AD |
418 | $score_pic = theme_image($link, |
419 | "images/" . get_score_pic($line["action_param"])); | |
0966ea37 | 420 | |
883fee8d | 421 | $score_pic = "<img class='hlScorePic' src=\"$score_pic\">"; |
0966ea37 AD |
422 | |
423 | $line["action_param"] = "$score_pic " . $line["action_param"]; | |
424 | ||
425 | } | |
ef8be8ea | 426 | |
47439031 | 427 | $line["feed_title"] = htmlspecialchars($line["feed_title"]); |
ef8be8ea AD |
428 | |
429 | print "<td align='center'><input onclick='toggleSelectPrefRow(this, \"filter\");' | |
430 | type=\"checkbox\" id=\"FICHK-".$line["id"]."\"></td>"; | |
431 | ||
7f94284b AD |
432 | $filter_params = array( |
433 | "before" => __("before"), | |
434 | "after" => __("after")); | |
a970edb1 AD |
435 | |
436 | if ($line["action_name"] == 'label') { | |
437 | ||
438 | $tmp_result = db_query($link, "SELECT fg_color, bg_color | |
439 | FROM ttrss_labels2 WHERE caption = '". | |
440 | db_escape_string($line["action_param"])."' AND | |
441 | owner_uid = " . $_SESSION["uid"]); | |
442 | ||
443 | $fg_color = db_fetch_result($tmp_result, 0, "fg_color"); | |
444 | $bg_color = db_fetch_result($tmp_result, 0, "bg_color"); | |
445 | ||
446 | $tmp = "<div class='labelColorIndicator' id='LICID-$id' | |
447 | style='color : $fg_color; background-color : $bg_color'> | |
448 | α"; | |
449 | $tmp .= "</div>"; | |
450 | ||
451 | $line["action_param"] = "$tmp " . $line["action_param"]; | |
452 | } | |
453 | ||
7f94284b AD |
454 | if ($line["filter_type"] == 5) { |
455 | ||
456 | if (!strtotime($line["reg_exp"])) { | |
457 | $line["reg_exp"] = "<span class=\"filterDateError\">" . | |
458 | $line["reg_exp"] . "</span>"; | |
459 | } | |
460 | ||
461 | $line["reg_exp"] = __("Date") . " " . | |
462 | $filter_params[$line['filter_param']] . " " . | |
463 | $line["reg_exp"]; | |
464 | } | |
465 | ||
ef8be8ea AD |
466 | if (!$enabled) { |
467 | $line["reg_exp"] = "<span class=\"insensitive\">" . | |
a3c159c4 | 468 | $line["reg_exp"] . " " . __("(Disabled)")."</span>"; |
ef8be8ea AD |
469 | $line["feed_title"] = "<span class=\"insensitive\">" . |
470 | $line["feed_title"] . "</span>"; | |
471 | $line["filter_type_descr"] = "<span class=\"insensitive\">" . | |
472 | $line["filter_type_descr"] . "</span>"; | |
473 | $line["action_description"] = "<span class=\"insensitive\">" . | |
474 | $line["action_description"] . "</span>"; | |
a82dc5e4 AD |
475 | $line["action_param"] = "<span class=\"insensitive\">" . |
476 | $line["action_param"] . "</span>"; | |
ef8be8ea | 477 | } |
a95da136 AD |
478 | |
479 | $onclick = "onclick='editFilter($filter_id)' title='".__('Click to edit')."'"; | |
480 | ||
3f2ff803 AD |
481 | $inverse_label = ""; |
482 | ||
483 | if ($inverse) { | |
a3c159c4 | 484 | $inverse_label = " <span class='insensitive'>".__('(Inverse)')."</span>"; |
3f2ff803 | 485 | } |
1b74062f AD |
486 | |
487 | print "<td $onclick>" . $line["reg_exp"] . "$inverse_label</td>"; | |
488 | print "<td $onclick>" . $line["feed_title"] . "</td>"; | |
ef8be8ea | 489 | |
1b74062f | 490 | print "<td $onclick>" . $line["filter_type_descr"] . "</td>"; |
08e618f7 | 491 | print "<td $onclick>" . $line["action_param"] . "</td>"; |
ff6e357a | 492 | |
ef8be8ea AD |
493 | print "</tr>"; |
494 | ||
495 | ++$lnum; | |
496 | } | |
a5bd7bf0 | 497 | |
ef8be8ea AD |
498 | print "</table>"; |
499 | ||
ef8be8ea AD |
500 | } else { |
501 | ||
9c87d75c | 502 | print "<p>"; |
9c87d75c | 503 | if (!$filter_search) { |
cea04d61 | 504 | print_warning(__('No filters defined.')); |
9c87d75c | 505 | } else { |
cea04d61 | 506 | print_warning(__('No matching filters found.')); |
9c87d75c | 507 | } |
9c87d75c | 508 | print "</p>"; |
ef8be8ea AD |
509 | |
510 | } | |
511 | } | |
ceb30ba4 AD |
512 | |
513 | function print_label_select($link, $name, $value, $style = "") { | |
514 | ||
515 | $result = db_query($link, "SELECT caption FROM ttrss_labels2 | |
516 | WHERE owner_uid = '".$_SESSION["uid"]."' ORDER BY caption"); | |
517 | ||
518 | print "<select name=\"$name\" style=\"$style\">"; | |
519 | ||
520 | while ($line = db_fetch_assoc($result)) { | |
521 | ||
522 | $issel = ($line["caption"] == $value) ? "selected" : ""; | |
523 | ||
524 | print "<option $issel>" . $line["caption"] . "</option>"; | |
525 | ||
526 | } | |
527 | ||
528 | print "</select>"; | |
529 | ||
530 | ||
531 | } | |
ef8be8ea | 532 | ?> |