/
icons.php
48 lines (40 loc) · 1.66 KB
/
icons.php
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
48
<?php
namespace Concrete\Controller\SinglePage\Dashboard\System\Basics;
use Concrete\Core\Page\Controller\DashboardPageController;
use Concrete\Core\Page\Controller\DashboardSitePageController;
use Config;
use View;
use Core;
class Icons extends DashboardSitePageController
{
public $helpers = array('form', 'concrete/asset_library', 'json');
public function on_start()
{
parent::on_start();
$view = View::getInstance();
$view->requireAsset('core/colorpicker');
$this->set('config', $this->getSite()->getConfigRepository());
}
public function icons_saved()
{
$this->set('message', t("Icons updated successfully."));
}
public function update_icons()
{
$config = $this->getSite()->getConfigRepository();
if ($this->token->validate("update_icons")) {
$s = Core::make('helper/security');
$faviconFID = $s->sanitizeInt($this->post('faviconFID'));
$iosHomeFID = $s->sanitizeInt($this->post('iosHomeFID'));
$modernThumbFID = $s->sanitizeInt($this->post('modernThumbFID'));
$modernThumbBG = $s->sanitizeString($this->post('modernThumbBG'));
$config->save('misc.favicon_fid', intval($faviconFID));
$config->save('misc.iphone_home_screen_thumbnail_fid', intval($iosHomeFID));
$config->save('misc.modern_tile_thumbnail_fid', intval($modernThumbFID));
$config->save('misc.modern_tile_thumbnail_bgcolor', $modernThumbBG);
$this->redirect('/dashboard/system/basics/icons/', 'icons_saved');
} else {
$this->set('error', array($this->token->getErrorMessage()));
}
}
}