<?
require_once('include/global.php');
require_once('conf.inc.php');


// set
	$CFG['TITLE'] = '<b>환경설정</b> >> <b>기본 설정</b>';


// data
	$row = get_default_config($AUTH['auth_m_no']);

	$view = array();
	// 메일박스
		$mail_box = get_mail_box();
		$_mail_box = db_rows_fieldtokey($mail_box);
		$select_mail_box = select_list_value($_GET['mb_id'], $_mail_box['mb_name'], $_mail_box['mb_id'], NULL, 0, 1);

	$view['m_cfg_new_mail_box'] = checkbox_value("m_cfg_new_mail_box[]", explode('|', $row['m_cfg_new_mail_box']), $_mail_box['mb_name'], $_mail_box['mb_id'], 0);
	$view['m_cfg_new_cnt'] = select_list_value($row['m_cfg_new_cnt'], array_values($G_SYS['M_CFG_NEW_CNT']), array_keys($G_SYS['M_CFG_NEW_CNT']), NULL, 0, 1);
	$view['m_cfg_week_diray_cnt'] = select_list_value($row['m_cfg_week_diray_cnt'], array_values($G_SYS['M_CFG_NEW_CNT']), array_keys($G_SYS['M_CFG_NEW_CNT']), NULL, 0, 1);
	$view['m_cfg_from_name'] = input_value($row['m_cfg_from_name'], 1);
	$view['m_cfg_mail_list_cnt'] = select_list_value($row['m_cfg_mail_list_cnt'], array_values($G_SYS['M_CFG_MAIL_LIST_CNT']), array_keys($G_SYS['M_CFG_MAIL_LIST_CNT']), NULL, 0, 1);

	// [2013-01-28] 보낸사람 선택기능 (앨리어스 도메인/주소 연동)
	$view['mf_from_name_default'] = $row['m_cfg_from_name'];

	$view['mf_from_select'] = array();

	if (!$G_SYS['NM_ALIAS_MAIL_FROM_SEL_SKIP'])
	{
		$q = "SELECT m_id, m_cfg_from_name name, m_cfg_from_addr FROM " . $TB['MEMBER'] . " WHERE d_no='" . $G['DINFO']['d_no'] . "' AND m_usertype='A' AND m_name='" . $AUTH['auth_m_id'] . "' ORDER BY m_id";
		$member_alias = db_get_rows($q);

		foreach ($member_alias as $key2=>$member)
		{
			if ($member['name'] == '')
				$member['name'] = $view['mf_from_name_default'];
			$view['mf_from_select'][] = array('name'=>$member['name'], 'email'=>$member['m_id'].'@'.$G['DINFO']['d_name'], 'id'=>$member['m_id'], 'isuse'=>$member['m_cfg_from_addr']);
		}	// foreach()
	}	// if()


// skin view
	$CFG['ACTION'] = 'default_config_ok.php';
	nskinset('webmail', 'default_config.html');
	include($NSKIN['view_layout']);


require_once('include/global_end.php');
?>