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