function sql_get_actions($_uid, $_rid) {
global $philter;
-
+ /*
$left_joins = "";
foreach($philter->config['action_plugins'] as $plug)
$left_joins .= $plug->sql_get();
-
+ */
$bd = bd()."actions";
- $sql = mysql_query("SELECT * FROM $bd WHERE $bd.uid='$_uid' AND $bd.rid='$_rid' ".$left_joins);
+ $sql = mysql_query("SELECT * FROM $bd WHERE $bd.uid='$_uid' AND $bd.rid='$_rid'");
while($t = mysql_fetch_assoc($sql))
$this->actions[] = $philter->config['action_plugins'][$t['pid']]->sql_to_data($t);
function sql_get_matches($_uid, $_rid) {
global $philter;
-
+
+ /*
$left_joins = "";
foreach($philter->config['match_plugins'] as $plug)
$left_joins .= $plug->sql_get();
+ */
$bd = bd()."matches";
- $sql = mysql_query("SELECT * FROM $bd WHERE $bd.uid='$_uid' AND $bd.rid='$_rid' ".$left_joins);
+ $sql = mysql_query("SELECT * FROM $bd WHERE $bd.uid='$_uid' AND $bd.rid='$_rid'");
if($_rid)
while($t = mysql_fetch_assoc($sql))
}
function to_string() {
- return "";
+ global $philter;
+
+ $res = ($this->block ? ":0\n" : ":0 c\n");
+ foreach($this->matches as $match)
+ $res .= $philter->['config']['match_plugins'][$match[0]]->to_string($match);
+ $res.= "{\n";
+ foreach($this->actions as $action)
+ $res .= $philter->['config']['actioh_plugins'][$action[0]]->to_string($action);
+ $res.= "}\n\n";
+
+ return $res;
}
function sql_clean($_uid, $_rid) {
mysql_query("DELETE FROM ".bd()."rules WHERE uid='$_uid' AND rid='$_rid'");
mysql_query("DELETE FROM ".bd()."actions WHERE uid='$_uid' AND rid='$_rid'");
mysql_query("DELETE FROM ".bd()."matches WHERE uid='$_uid' AND rid='$_rid'");
+ /*
foreach($philter->config['action_plugins'] as $plug)
$plug->sql_clean($_uid, $_rid);
foreach($philter->config['match_plugins'] as $plug)
$plug->sql_clean($_uid, $_rid);
+ */
}
function sql_store($_uid, $_rid) {
function to_js() {
$matches = array();
- ksort($this->matches);
foreach($this->matches as $data) {
+ ksort($data);
$data = array_map('to_js_str', $data);
$matches[] = '[' . implode(',', $data) . ']';
}
$actions = array();
foreach($this->actions as $data) {
+ ksort($data);
$data = array_map('to_js_str', $data);
$actions[] = '[' . implode(',', $data) . ']';
}