本文整理汇总了PHP中Model_Config::getTableName方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Config::getTableName方法的具体用法?PHP Model_Config::getTableName怎么用?PHP Model_Config::getTableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_Config
的用法示例。
在下文中一共展示了Model_Config::getTableName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_index
public function action_index()
{
// check permission
if (\Model_AccountLevelPermission::checkAdminPermission('config_global', 'config_global') == false) {
\Session::set_flash('form_status', array('form_status' => 'error', 'form_status_message' => \Lang::get('admin_permission_denied', array('page' => \Uri::string()))));
\Response::redirect(\Uri::create('admin'));
}
// get timezone list for select box
\Config::load('timezone', 'timezone');
$output['timezone_list'] = \Config::get('timezone.timezone', array());
// read flash message for display errors.
$form_status = \Session::get_flash('form_status');
if (isset($form_status['form_status']) && isset($form_status['form_status_message'])) {
$output['form_status'] = $form_status['form_status'];
$output['form_status_message'] = $form_status['form_status_message'];
}
unset($form_status);
$allowed_field = array();
// load config to form.
$result = \DB::select('*')->from(\Model_Config::getTableName())->as_object('Model_Config')->where('config_core', '1')->execute();
if ((is_array($result) || is_object($result)) && !empty($result)) {
foreach ($result as $row) {
$allowed_field[] = $row->config_name;
$output[$row->config_name] = $row->config_value;
}
}
unset($result, $row);
// if form submitted
if (\Input::method() == 'POST') {
// store data to variable for update to db.
$data = array();
foreach (\Input::post() as $key => $value) {
if (in_array($key, $allowed_field)) {
$data[$key] = $value;
}
}
unset($allowed_field);
// check again for some required default value config data.
// tab website
$data['site_name'] = \Security::htmlentities($data['site_name']);
$data['page_title_separator'] = \Security::htmlentities($data['page_title_separator']);
// tab account
if (!isset($data['member_allow_register']) || $data['member_allow_register'] != '1') {
$data['member_allow_register'] = '0';
}
if (!isset($data['member_register_notify_admin']) || $data['member_register_notify_admin'] != '1') {
$data['member_register_notify_admin'] = '0';
}
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';
}
//.........这里部分代码省略.........