1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/movim_ynh.git synced 2024-09-03 19:46:19 +02:00
movim_ynh/sources/app/models/privacy/PrivacyDAO.php
2016-03-15 16:28:38 +01:00

58 lines
1.3 KiB
PHP

<?php
namespace modl;
class PrivacyDAO extends SQL {
function set(Privacy $p) {
$this->_sql = '
update privacy
set value = :value,
hash = :hash
where pkey = :pkey';
$this->prepare(
'Privacy',
array(
'pkey' => $p->pkey,
'value' => $p->value,
'hash' => $p->hash
)
);
$this->run('Privacy');
if(!$this->_effective) {
$this->_sql = '
insert into privacy
(pkey, value, hash)
values (:pkey,:value,:hash)';
$this->prepare(
'Privacy',
array(
'pkey' => $p->pkey,
'value' => $p->value,
'hash' => $p->hash
)
);
$this->run('Privacy');
}
}
function get($key) {
$this->_sql = '
select * from privacy
where
pkey = :pkey';
$this->prepare(
'Privacy',
array(
'pkey' => $key
)
);
return $this->run('Privacy', 'item');
}
}