projects
/
old-projects.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
better base functions
[old-projects.git]
/
philter
/
philter
/
include
/
plugin.inc.php
diff --git
a/philter/philter/include/plugin.inc.php
b/philter/philter/include/plugin.inc.php
index
f4ddb87
..
71894c3
100644
(file)
--- a/
philter/philter/include/plugin.inc.php
+++ b/
philter/philter/include/plugin.inc.php
@@
-42,10
+42,10
@@
class Plugin {
* @return an array with the shorter datas
*/
function sql_to_data(&$sql) {
* @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
}
/** gives the procmailrc instruction of the data associated with this Plugin
@@
-65,7
+65,11
@@
class ActionPlugin extends Plugin {
function ActionPlugin() { $this->Plugin(); }
function sql_store($_uid, $_rid, $_data) {
function ActionPlugin() { $this->Plugin(); }
function sql_store($_uid, $_rid, $_data) {
- mysql_query("INSERT INTO ".bd()."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'");
}
}
}
}
@@
-80,10
+84,14
@@
class MatchPlugin extends Plugin {
}
function sql_store($_uid, $_rid, $_data) {
}
function sql_store($_uid, $_rid, $_data) {
+ if(count($_data) == 2)
+ $data = $_data[1];
+ else
+ $data = serialize($_data);
if($this->global)
if($this->global)
- mysql_query("INSERT INTO ".bd()."matches SET uid='$_uid',rid='0',pid='{$_data[0]}',data='
{$_data[1]}
'");
+ mysql_query("INSERT INTO ".bd()."matches SET uid='$_uid',rid='0',pid='{$_data[0]}',data='
$data
'");
else
else
- mysql_query("INSERT INTO ".bd()."matches SET uid='$_uid',rid='$_rid',pid='{$_data[0]}',data='
{$_data[1]}
'");
+ 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
}
/** true if the plugin is used as global rule