-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTDBMetaData.php
More file actions
executable file
·47 lines (37 loc) · 1 KB
/
TDBMetaData.php
File metadata and controls
executable file
·47 lines (37 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
class TDBMetaData extends TDBBase
{
public $_table = 'meta_data';
function getMetaData($guid)
{
$this->find('guid = '.$guid);
while ($data = $this->next() )
{
$rs[$data['name']] = $data;
}
return $rs;
}
function saveMetaData($guid,$data)
{
// guid , name ,value , last_changed
foreach($data as $key => $item)
{
if ($item['data_type'] != 'field')
{
$type = '';
$meta = '';
$data_type = '';
$value = '';
// if (!empty($item['meta']))
$meta = ' meta = "'.$this->escape($item['meta']).'" , ';
$data_type = ' data_type = "'.$this->escape(strtolower($item['data_type'])).'" , ';
if (isset($item['value']))
$value = ' value = "'.$this->escape($item['value']).'" , ';
$sql = 'replace into '.$this->_table.' set '.$data_type. $meta. $value
.' name = "'.$this->escape($key).'" , guid = '.$this->escape($guid)
.' , last_changed = now()';
$this->update($sql);
}
}
}
}