α " . $line['action_param']; $line['action_param'] = $tmp; } } } $filter = array(); $filter['id'] = 'FILTER:' . $line['id']; $filter['bare_id'] = $line['id']; $filter['name'] = $line['reg_exp']; $filter['type'] = $line['filter_type']; $filter['enabled'] = sql_bool_to_bool($line['enabled']); $filter['param'] = $line['action_param']; $filter['inverse'] = sql_bool_to_bool($line['inverse']); $filter['checkbox'] = false; if ($line['feed_id']) $filter['feed'] = $line['feed_title']; array_push($cat['items'], $filter); } array_push($root['items'], $cat); $fl = array(); $fl['identifier'] = 'id'; $fl['label'] = 'name'; $fl['items'] = array($root); print json_encode($fl); return; } if ($subop == "edit") { $filter_id = db_escape_string($_REQUEST["id"]); header("Content-Type: text/xml"); print ""; print "".__('Filter Editor').""; print ""; print ""; print ""; print ""; $result = db_query($link, "SELECT id,description FROM ttrss_filter_types ORDER BY description"); $filter_types = array(); while ($line = db_fetch_assoc($result)) { //array_push($filter_types, $line["description"]); $filter_types[$line["id"]] = __($line["description"]); } print "
".__("Match")."
"; print "
"; if ($filter_type != 5) { $date_ops_invisible = 'style="display : none"'; } print ""; print __("Date") . " "; $filter_params = array( "before" => __("before"), "after" => __("after")); print_select_hash("filter_date_modifier", $filter_param, $filter_params); print " "; print ""; print ""; print " "; print ""; print "
" . __("on field") . " "; print_select_hash("filter_type", $filter_type, $filter_types, 'onchange="filterDlgCheckType(this)"'); print "
"; print __("in") . " "; print_feed_select($link, "feed_id", $feed_id); print "
"; print "
".__("Perform Action")."
"; print "
"; print ""; $param_hidden = ($action_id == 4 || $action_id == 6 || $action_id == 7) ? "" : "display : none"; print ""; print " " . __("with parameters:") . " "; $param_int_hidden = ($action_id != 7) ? "" : "display : none"; print ""; $param_int_hidden = ($action_id == 7) ? "" : "display : none"; print_label_select($link, "action_param_label", $action_param, $param_int_hidden); print ""; print " "; // tiny layout hack print "
"; print "
".__("Options")."
"; print "
"; print "
"; if ($enabled) { $checked = "checked"; } else { $checked = ""; } print "
"; if ($inverse) { $checked = "checked"; } else { $checked = ""; } print " "; print "
"; print "
"; print "
"; $reg_exp = htmlspecialchars($reg_exp, ENT_QUOTES); // second escaping seems to be needed for javascript print "
"; print ""; print "
"; print " "; print ""; print "]]>"; return; } if ($subop == "editSave") { global $memcache; if ($memcache) $memcache->flush(); $reg_exp = db_escape_string(trim($_REQUEST["reg_exp"])); $filter_type = db_escape_string(trim($_REQUEST["filter_type"])); $filter_id = db_escape_string($_REQUEST["id"]); $feed_id = db_escape_string($_REQUEST["feed_id"]); $action_id = db_escape_string($_REQUEST["action_id"]); $action_param = db_escape_string($_REQUEST["action_param"]); $action_param_label = db_escape_string($_REQUEST["action_param_label"]); $enabled = checkbox_to_sql_bool(db_escape_string($_REQUEST["enabled"])); $inverse = checkbox_to_sql_bool(db_escape_string($_REQUEST["inverse"])); # for the time being, no other filters use params anyway... $filter_param = db_escape_string($_REQUEST["filter_date_modifier"]); if (!$feed_id) { $feed_id = 'NULL'; } else { $feed_id = sprintf("'%s'", db_escape_string($feed_id)); } /* When processing 'assign label' filters, action_param_label dropbox * overrides action_param */ if ($action_id == 7) { $action_param = $action_param_label; } $result = db_query($link, "UPDATE ttrss_filters SET reg_exp = '$reg_exp', feed_id = $feed_id, action_id = '$action_id', filter_type = '$filter_type', enabled = $enabled, inverse = $inverse, action_param = '$action_param', filter_param = '$filter_param' WHERE id = '$filter_id' AND owner_uid = " . $_SESSION["uid"]); } if ($subop == "remove") { if ($memcache) $memcache->flush(); $ids = split(",", db_escape_string($_REQUEST["ids"])); foreach ($ids as $id) { db_query($link, "DELETE FROM ttrss_filters WHERE id = '$id' AND owner_uid = ". $_SESSION["uid"]); } } if ($subop == "add") { if ($memcache) $memcache->flush(); $regexp = db_escape_string(trim($_REQUEST["reg_exp"])); $filter_type = db_escape_string(trim($_REQUEST["filter_type"])); $feed_id = db_escape_string($_REQUEST["feed_id"]); $action_id = db_escape_string($_REQUEST["action_id"]); $action_param = db_escape_string($_REQUEST["action_param"]); $action_param_label = db_escape_string($_REQUEST["action_param_label"]); $inverse = checkbox_to_sql_bool(db_escape_string($_REQUEST["inverse"])); # for the time being, no other filters use params anyway... $filter_param = db_escape_string($_REQUEST["filter_date_modifier"]); if (!$regexp) return; if (!$feed_id) { $feed_id = 'NULL'; } else { $feed_id = sprintf("'%s'", db_escape_string($feed_id)); } /* When processing 'assign label' filters, action_param_label dropbox * overrides action_param */ if ($action_id == 7) { $action_param = $action_param_label; } $result = db_query($link, "INSERT INTO ttrss_filters (reg_exp,filter_type,owner_uid,feed_id, action_id, action_param, inverse, filter_param) VALUES ('$regexp', '$filter_type','".$_SESSION["uid"]."', $feed_id, '$action_id', '$action_param', $inverse, '$filter_param')"); if (db_affected_rows($link, $result) != 0) { print T_sprintf("Created filter %s", htmlspecialchars($regexp)); } return; } if ($quiet) return; $sort = db_escape_string($_REQUEST["sort"]); if (!$sort || $sort == "undefined") { $sort = "reg_exp"; } $result = db_query($link, "SELECT id,description FROM ttrss_filter_types ORDER BY description"); $filter_types = array(); while ($line = db_fetch_assoc($result)) { //array_push($filter_types, $line["description"]); $filter_types[$line["id"]] = $line["description"]; } $filter_search = db_escape_string($_REQUEST["search"]); if (array_key_exists("search", $_REQUEST)) { $_SESSION["prefs_filter_search"] = $filter_search; } else { $filter_search = $_SESSION["prefs_filter_search"]; } print "
"; print "
"; print "
"; print "
". "" . __('Select').""; print "
"; print "
".__('All')."
"; print "
".__('None')."
"; print "
"; print " "; print " "; print " "; if (defined('_ENABLE_FEED_DEBUGGING')) { print " "; } print "
"; # toolbar print "
"; # toolbar-frame print "
"; print "
". __("Loading, please wait...")."
"; print "
"; print "
"; #pane print "
"; #container } ?>