本文整理匯總了PHP中Model_Config::saveData方法的典型用法代碼示例。如果您正苦於以下問題:PHP Model_Config::saveData方法的具體用法?PHP Model_Config::saveData怎麽用?PHP Model_Config::saveData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Model_Config
的用法示例。
在下文中一共展示了Model_Config::saveData方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: action_index
//.........這裏部分代碼省略.........
}
if (!isset($data['simultaneous_login']) || $data['simultaneous_login'] != '1') {
$data['simultaneous_login'] = '0';
}
if (!is_numeric($data['member_max_login_fail'])) {
$data['member_max_login_fail'] = '10';
}
if (!is_numeric($data['member_login_fail_wait_time'])) {
$data['member_login_fail_wait_time'] = '30';
}
if (!is_numeric($data['member_login_remember_length'])) {
$data['member_login_remember_length'] = '30';
}
if (!is_numeric($data['member_confirm_wait_time'])) {
$data['member_confirm_wait_time'] = '10';
}
if (!isset($data['member_email_change_need_confirm']) || $data['member_email_change_need_confirm'] != '1') {
$data['member_email_change_need_confirm'] = '0';
}
if (!isset($data['allow_avatar']) || $data['allow_avatar'] != '1') {
$data['allow_avatar'] = '0';
}
if (!is_numeric($data['avatar_size'])) {
$data['avatar_size'] = '200';
}
if (empty($data['avatar_allowed_types'])) {
$data['avatar_allowed_types'] = 'jpg|jpeg';
}
if ($data['avatar_path'] == null) {
unset($data['avatar_path']);
}
// tab email
if ($data['mail_protocol'] == null) {
$data['mail_protocol'] = 'mail';
}
if (!is_numeric($data['mail_smtp_port'])) {
$data['mail_smtp_port'] = '0';
}
// tab content
if (!is_numeric($data['content_items_perpage'])) {
$data['content_items_perpage'] = '10';
}
if (!is_numeric($data['content_admin_items_perpage'])) {
$data['content_admin_items_perpage'] = '10';
}
// tab media
if (empty($data['media_allowed_types'])) {
$data['media_allowed_types'] = 'avi|doc|docx|flv|gif|jpeg|jpg|mid|midi|mov|mp3|mpeg|mpg|pdf|png|swf|xls|xlsx|zip';
}
// tab ftp
if (!is_numeric($data['ftp_port'])) {
$data['ftp_port'] = '21';
}
if (!isset($data['ftp_passive']) || $data['ftp_passive'] != 'false') {
$data['ftp_passive'] = 'true';
}
// validate form.
$validate = \Validation::forge();
if (!\Extension\NoCsrf::check()) {
// validate token failed
$output['form_status'] = 'error';
$output['form_status_message'] = \Lang::get('fslang_invalid_csrf_token');
} elseif (!$validate->run()) {
// validate failed
$output['form_status'] = 'error';
$output['form_status_message'] = $validate->show_errors();
} else {
// try to save config.
$result = \Model_Config::saveData($data);
// save change site name to sites table
$site_id = \Model_Sites::getSiteId(false);
$entry = \Model_Sites::find($site_id);
$entry->site_name = $data['site_name'];
$entry->save();
unset($entry, $site_id);
if ($result === true) {
\Session::set_flash('form_status', array('form_status' => 'success', 'form_status_message' => \Lang::get('admin_saved')));
\Response::redirect(\Uri::main());
} else {
$output['form_status'] = 'error';
$output['form_status_message'] = $result;
}
}
// re-populate form.
foreach ($data as $key => $value) {
$output[$key] = html_entity_decode($value);
}
}
// <head> output ----------------------------------------------------------------------------------------------
$output['page_title'] = $this->generateTitle(\Lang::get('config_global_configuration'));
// <head> output ----------------------------------------------------------------------------------------------
// breadcrumb -------------------------------------------------------------------------------------------------
$page_breadcrumb = [];
$page_breadcrumb[0] = ['name' => \Lang::get('admin_admin_home'), 'url' => \Uri::create('admin')];
$page_breadcrumb[1] = ['name' => \Lang::get('config_global_configuration'), 'url' => \Uri::create('admin/config')];
$output['page_breadcrumb'] = $page_breadcrumb;
unset($page_breadcrumb);
// breadcrumb -------------------------------------------------------------------------------------------------
return $this->generatePage('admin/templates/config/index_v', $output, false);
}