function op_emailset() { if (isset($_POST['smtp_host'])) { $upate['smtp_host'] = $_POST['smtp_host']; } if (isset($_POST['smtp_port'])) { $upate['smtp_port'] = $_POST['smtp_port']; } if (isset($_POST['smtp_account'])) { $upate['smtp_account'] = $_POST['smtp_account']; } if (isset($_POST['smtp_pass'])) { $upate['smtp_pass'] = $_POST['smtp_pass']; } if (isset($_POST['smtp_from'])) { $upate['smtp_from'] = $_POST['smtp_from']; } include_once "SettingModel.class.php"; $settingModel = new SettingModel(); $r = $settingModel->updateSettings($upate); $config_content = file_get_contents(APP_DIR . "/config/config.ini.php"); $config_content = preg_replace('/(\\["smtp_host"\\]\\s*=\\s*)(.*?)(;)/ism', '\\1"' . $upate['smtp_host'] . '"\\3', $config_content); $config_content = preg_replace('/(\\["smtp_port"\\]\\s*=\\s*)(.*?)(;)/ism', '\\1"' . $upate['smtp_port'] . '"\\3', $config_content); $config_content = preg_replace('/(\\["smtp_account"\\]\\s*=\\s*)(.*?)(;)/ism', '\\1"' . $upate['smtp_account'] . '"\\3', $config_content); $config_content = preg_replace('/(\\["smtp_pass"\\]\\s*=\\s*)(.*?)(;)/ism', '\\1"' . $upate['smtp_pass'] . '"\\3', $config_content); $config_content = preg_replace('/(\\["smtp_from"\\]\\s*=\\s*)(.*?)(;)/ism', '\\1"' . $upate['smtp_from'] . '"\\3', $config_content); $r1 = write_file($config_content, APP_DIR . "/config/config.ini.php"); if ($r && $r1) { show_message_goback(lang('success')); } else { show_message_goback(lang('failed')); } }