1 <?php
defined('IN_CMS') or die('No direct access allowed.');
5 public static function update() {
6 $post = Input
::post(array('sitename', 'description', 'theme', 'twitter', 'home_page', 'posts_page', 'auto_published_comments', 'posts_per_page'));
9 if(empty($post['sitename'])) {
10 $errors[] = 'You need a site sitename';
13 if(empty($post['description'])) {
14 $errors[] = 'You need a site description';
17 if(empty($post['theme'])) {
18 $errors[] = 'You need a theme';
21 // auto publish comments
22 $post['auto_published_comments'] = $post['auto_published_comments'] ?
1 : 0;
24 // format posts per page, must be a whole number above 1 defaults to 10 if a invalid number is entered
25 $post['posts_per_page'] = ($posts_per_page = intval($post['posts_per_page'])) > 0 ?
$posts_per_page : 10;
28 Notifications
::set('error', $errors);
32 foreach($post as $key => $value) {
33 Db
::update('meta', array('value' => $value), array('key' => $key));
36 Notifications
::set('success', 'Your metadata has been updated');