/** gives the LEFT JOIN to add to the sql request to have all this plugin datas
* @return the LEFT JOIN string, "" if irrelevant
*/
- function sql_get() { return ""; }
-
- function sql_clean($_uid, $_rid) { }
+ // function sql_get() { return ""; }
+ // function sql_clean($_uid, $_rid) { }
/** stores the data to the mysql database
* @param $_uid the id of the filter
* @return an array with the shorter datas
*/
function sql_to_data(&$sql) {
- $res = array();
- $res[] = $sql['pid'];
- $res[] = $sql['data'];
- return $res;
+ if(preg_match('/^a:\d+:\{.*\}$/', $sql['data']))
+ return unserialize($sql['data']);
+ else
+ return array($sql['pid'], $sql['data']);
}
/** gives the procmailrc instruction of the data associated with this Plugin
function ActionPlugin() { $this->Plugin(); }
function sql_store($_uid, $_rid, $_data) {
- mysql_query("INSERT INTO actions SET uid='$_uid',rid='$_rid',pid='{$_data[0]}',data='{$_data[1]}'");
+ if(count($_data) == 2)
+ $data = $_data[1];
+ else
+ $data = serialize($_data);
+ mysql_query("INSERT INTO ".bd()."actions SET uid='$_uid',rid='$_rid',pid='{$_data[0]}',data='$data'");
}
}
$this->global=$_glob;
}
+ function sql_store($_uid, $_rid, $_data) {
+ if(count($_data) == 2)
+ $data = $_data[1];
+ else
+ $data = serialize($_data);
+ if($this->global)
+ mysql_query("INSERT INTO ".bd()."matches SET uid='$_uid',rid='0',pid='{$_data[0]}',data='$data'");
+ else
+ mysql_query("INSERT INTO ".bd()."matches SET uid='$_uid',rid='$_rid',pid='{$_data[0]}',data='$data'");
+ }
+
/** true if the plugin is used as global rule
* overload with (return false) if the plugin can not be used as a global rule
* overload with (return true) if the plugin can not be used as a normal rule
* @return true if usable as a global rule, false else
*/
- function is_global() { return $global; }
+ function is_global() { return $this->global; }
}
/********************************************************************************