if (isset($_GET["id"])) { $pieces = explode('_', $_GET['id'], 2); $lang_code = $pieces[0]; $charset = $pieces[1]; } $languagesDAO = new LanguagesDAO(); $langCodesDAO = new LangCodesDAO(); // handle submits if (isset($_POST['cancel'])) { $msg->addFeedback('CANCELLED'); header('Location: index.php'); exit; } else { if (isset($_POST['save'])) { if (isset($_GET["id"])) { if ($languagesDAO->Update($lang_code, $charset, '', trim($_POST['native_name']), trim($_POST['english_name']), $_POST['status'])) { $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY'); header('Location: index.php'); exit; } } else { if (isset($_POST['locale']) && $_POST['locale'] != '') { $language_code = $_POST['lang_code'] . AC_LANGUAGE_LOCALE_SEP . $_POST['locale']; } else { $language_code = $_POST['lang_code']; } if ($languagesDAO->Create($language_code, trim($_POST['charset']), '', trim($_POST['native_name']), trim($_POST['english_name']), $_POST['status'])) { $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY'); header('Location: index.php'); exit; }