function postSettings() { isset($_POST['enable']) ? PHPWS_Settings::set('whatsnew', 'enable', 1) : PHPWS_Settings::set('whatsnew', 'enable', 0); isset($_POST['homeonly']) ? PHPWS_Settings::set('whatsnew', 'homeonly', 1) : PHPWS_Settings::set('whatsnew', 'homeonly', 0); if (!empty($_POST['title'])) { PHPWS_Settings::set('whatsnew', 'title', strip_tags(PHPWS_Text::parseInput($_POST['title']))); } else { PHPWS_Settings::reset('whatsnew', 'title'); } if (!empty($_POST['text'])) { PHPWS_Settings::set('whatsnew', 'text', PHPWS_Text::parseInput($_POST['text'])); } else { PHPWS_Settings::set('whatsnew', 'text', null); } $cache_timeout = (int) $_POST['cache_timeout']; if ((int) $cache_timeout <= 7200) { PHPWS_Settings::set('whatsnew', 'cache_timeout', $cache_timeout); } else { PHPWS_Settings::reset('whatsnew', 'cache_timeout'); } $qty_items = (int) $_POST['qty_items']; if ((int) $qty_items <= 50) { PHPWS_Settings::set('whatsnew', 'qty_items', $qty_items); } else { PHPWS_Settings::reset('whatsnew', 'qty_items'); } isset($_POST['show_summaries']) ? PHPWS_Settings::set('whatsnew', 'show_summaries', 1) : PHPWS_Settings::set('whatsnew', 'show_summaries', 0); isset($_POST['show_dates']) ? PHPWS_Settings::set('whatsnew', 'show_dates', 1) : PHPWS_Settings::set('whatsnew', 'show_dates', 0); isset($_POST['show_source_modules']) ? PHPWS_Settings::set('whatsnew', 'show_source_modules', 1) : PHPWS_Settings::set('whatsnew', 'show_source_modules', 0); if (isset($_POST['exclude'])) { PHPWS_Settings::set('whatsnew', 'exclude', $_POST['exclude']); } if (isset($errors)) { $this->message = implode('<br />', $errors); return false; } else { PHPWS_Cache::remove('whatsnew_cache_key'); if (PHPWS_Settings::save('whatsnew')) { return true; } else { return false; } } }
public static function postSettings() { if (isset($_POST['show_recent'])) { PHPWS_Settings::set('blog', 'show_recent', $_POST['show_recent']); } isset($_POST['captcha_submissions']) ? PHPWS_Settings::set('blog', 'captcha_submissions', 1) : PHPWS_Settings::set('blog', 'captcha_submissions', 0); isset($_POST['home_page_display']) ? PHPWS_Settings::set('blog', 'home_page_display', 1) : PHPWS_Settings::set('blog', 'home_page_display', 0); isset($_POST['allow_anonymous_submits']) ? PHPWS_Settings::set('blog', 'allow_anonymous_submits', 1) : PHPWS_Settings::set('blog', 'allow_anonymous_submits', 0); isset($_POST['logged_users_only']) ? PHPWS_Settings::set('blog', 'logged_users_only', 1) : PHPWS_Settings::set('blog', 'logged_users_only', 0); isset($_POST['show_posted_date']) ? PHPWS_Settings::set('blog', 'show_posted_date', 1) : PHPWS_Settings::set('blog', 'show_posted_date', 0); isset($_POST['show_posted_by']) ? PHPWS_Settings::set('blog', 'show_posted_by', 1) : PHPWS_Settings::set('blog', 'show_posted_by', 0); if (isset($_POST['view_only']) && is_array($_POST['view_only'])) { $view_only = implode(':', $_POST['view_only']); } else { $view_only = null; } PHPWS_Settings::set('blog', 'view_only', $view_only); if (isset($_POST['simple_image'])) { PHPWS_Settings::set('blog', 'simple_image', 1); isset($_POST['mod_folders_only']) ? PHPWS_Settings::set('blog', 'mod_folders_only', 1) : PHPWS_Settings::set('blog', 'mod_folders_only', 0); if (!empty($_POST['max_width'])) { $max_width = (int) $_POST['max_width']; if ($max_width >= 50 && $max_width <= 2048) { PHPWS_Settings::set('blog', 'max_width', $max_width); } } if (!empty($_POST['max_height'])) { $max_height = (int) $_POST['max_height']; if ($max_height >= 50 && $max_height <= 2048) { PHPWS_Settings::set('blog', 'max_height', $max_height); } } } else { PHPWS_Settings::set('blog', 'simple_image', 0); } $past_limit = (int) $_POST['past_entries']; if ((int) $past_limit >= 0) { PHPWS_Settings::set('blog', 'past_entries', $past_limit); } else { PHPWS_Settings::reset('blog', 'past_entries'); } $blog_limit = (int) $_POST['blog_limit']; if ((int) $blog_limit > 0) { PHPWS_Settings::set('blog', 'blog_limit', $blog_limit); } else { PHPWS_Settings::reset('blog', 'blog_limit'); } PHPWS_Settings::set('blog', 'comment_script', $_POST['comment_script']); PHPWS_Settings::save('blog'); }