$pf = empty($q['query']['project_filter']) ? 'P,N,U' : $q['query']['project_filter'];
- $bits= explode(',' ,$pf);
- foreach($bits as $i=>$k) {
- $bits[$i] = $this->escape($k);
- }
- $this->whereAdd("Projects.type in ('". implode("','", $bits) . "')");
+
+
+
+ $this->whereAddIn("Projects.type", explode(',', $pf), 'string');
}
// user projects!!!! - make sure they can only see project they are suppsed to..
// only applies to document stuff..
}
- function whereAddIn($key, $list, $type) {
- $ar = array();
- foreach($list as $k) {
- $ar[] = $type =='int' ? (int)$k : $this->escape($k);
- }
- if (!$ar) {
- return;
- }
- $this->whereAdd("$key IN (". implode(',', $ar). ')');
- }
+
function onInsert()
{
$oo = clone($this);
$olddir = $opts['storedir'] . '/' . $old->code;
$newdir = $opts['storedir'] . '/' . $this->code;
if ( file_exists($olddir)) {
- move ($olddir, $newdir);
+ move($olddir, $newdir);
}