Browse Source
Move the user settings to the Settign model
Move the user settings to the Settign model
Add the NSFW switch + first implementation in the configpull/392/head
9 changed files with 188 additions and 39 deletions
-
61app/models/postn/PostnDAO.php
-
17app/models/setting/Setting.php
-
73app/models/setting/SettingDAO.php
-
9app/widgets/Config/Config.php
-
25app/widgets/Config/_config_form.tpl
-
2app/widgets/Config/locales.ini
-
10app/widgets/Presence/Presence.php
-
1src/Movim/Bootstrap.php
-
29src/Movim/User.php
@ -0,0 +1,17 @@ |
|||
<?php |
|||
|
|||
namespace Modl; |
|||
|
|||
class Setting extends Model |
|||
{ |
|||
public $language; |
|||
public $cssurl; |
|||
public $nsfw = false; |
|||
|
|||
public $_struct = [ |
|||
'session' => ['type' => 'string','size' => 96,'key' => true], |
|||
'language' => ['type' => 'string','size' => 6], |
|||
'cssurl' => ['type' => 'string','size' => 128], |
|||
'nsfw' => ['type' => 'bool','size' => 16] |
|||
]; |
|||
} |
@ -0,0 +1,73 @@ |
|||
<?php |
|||
|
|||
namespace Modl; |
|||
|
|||
class SettingDAO extends SQL |
|||
{ |
|||
function set(Setting $s) |
|||
{ |
|||
$this->_sql = ' |
|||
update setting |
|||
set language = :language, |
|||
cssurl = :cssurl, |
|||
nsfw = :nsfw |
|||
where session = :session'; |
|||
|
|||
$this->prepare( |
|||
'Setting', |
|||
[ |
|||
'language' => $s->language, |
|||
'cssurl' => $s->cssurl, |
|||
'nsfw' => $s->nsfw, |
|||
'session' => $this->_user |
|||
] |
|||
); |
|||
|
|||
$this->run('Config'); |
|||
|
|||
if(!$this->_effective) { |
|||
$this->_sql = ' |
|||
insert into setting |
|||
( |
|||
language, |
|||
cssurl, |
|||
nsfw, |
|||
session |
|||
) |
|||
values |
|||
( |
|||
:language, |
|||
:cssurl, |
|||
:nsfw, |
|||
:session |
|||
) |
|||
'; |
|||
|
|||
$this->prepare( |
|||
'Setting', |
|||
[ |
|||
'language' => $s->language, |
|||
'cssurl' => $s->cssurl, |
|||
'nsfw' => $s->nsfw, |
|||
'session' => $this->_user |
|||
] |
|||
); |
|||
|
|||
$this->run('Setting'); |
|||
} |
|||
} |
|||
|
|||
function get() |
|||
{ |
|||
$this->_sql = ' |
|||
select * from setting |
|||
where session = :session'; |
|||
|
|||
$this->prepare( |
|||
'Setting', |
|||
['session' => $this->_user] |
|||
); |
|||
|
|||
return $this->run('Setting', 'item'); |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue