$err = 'y'; } $sql = "SELECT * FROM lang_constants WHERE constant_name=? limit 1"; $res = SqlQuery($sql, array($_POST['constant_name'])); if ($res) { echo htmlspecialchars(xl('Data Alike is already in database, please change constant name'), ENT_NOQUOTES) . '<br>'; $err = 'y'; } if ($err == 'y') { $val_constant = $_POST['constant_name']; } else { //insert into the main table $sql = "INSERT INTO lang_constants SET constant_name=?"; SqlStatement($sql, array($_POST['constant_name'])); //insert into the log table - to allow persistant customizations insert_language_log('', '', $_POST['constant_name'], ''); echo htmlspecialchars(xl('Constant', '', '', ' ') . $_POST['constant_name'] . xl('added', '', ' '), ENT_NOQUOTES) . '<br>'; } // echo "$sql here "; } ?> <TABLE> <FORM name="cons_form" METHOD=POST ACTION="?m=constant" onsubmit="return top.restoreSession()"> <TR> <TD><?php echo htmlspecialchars(xl('constant name'), ENT_NOQUOTES); ?> </TD> <TD><INPUT TYPE="text" NAME="constant_name" size="100" value="<?php echo htmlspecialchars($val_constant, ENT_QUOTES);
$value = trim($value); // only continue if the definition is new $sql = "SELECT * FROM lang_definitions WHERE def_id=? AND definition=? " . $case_sensitive_collation; $res_test = SqlStatement($sql, array($key, $value)); if (!SqlFetchArray($res_test)) { // insert into the main language tables $sql = "UPDATE `lang_definitions` SET `definition`=? WHERE `def_id`=? LIMIT 1"; SqlStatement($sql, array($value, $key)); // insert each entry into the log table - to allow persistant customizations $sql = "SELECT ll.lang_description, ll.lang_code, lc.constant_name "; $sql .= "FROM lang_definitions AS ld, lang_languages AS ll, lang_constants AS lc "; $sql .= "WHERE ld.def_id=? "; $sql .= "AND ll.lang_id = ld.lang_id AND lc.cons_id = ld.cons_id LIMIT 1"; $res = SqlStatement($sql, array($key)); $row = SqlFetchArray($res); insert_language_log($row['lang_description'], $row['lang_code'], $row['constant_name'], $value); $go = 'yes'; } } } if ($go == 'yes') { echo htmlspecialchars(xl("New Definition set added"), ENT_NOQUOTES); } } if ($_POST['edit']) { if ($_POST['language_select'] == '') { exit(htmlspecialchars(xl("Please select a language"), ENT_NOQUOTES)); } $lang_id = (int) formData('language_select'); $lang_filter = isset($_POST['filter_cons']) ? $_POST['filter_cons'] : ''; $lang_filter .= '%';
} $sql = "SELECT * FROM lang_languages WHERE lang_code LIKE ? or lang_description LIKE ? limit 1"; $res = SqlQuery($sql, array("%" . $_POST['lang_code'] . "%", "%" . $_POST['lang_name'])); if ($res) { echo htmlspecialchars(xl("Data Alike is already in database, please change code and/or description"), ENT_NOQUOTES) . '<br>'; $err = 'y'; } if ($err == 'y') { $val_lang_code = $_POST['lang_code']; $val_lang_name = $_POST['lang_name']; } else { //insert into the main table $sql = "INSERT INTO lang_languages SET lang_code=?, lang_description=?"; SqlStatement($sql, array($_POST['lang_code'], $_POST['lang_name'])); //insert into the log table - to allow persistant customizations insert_language_log($_POST['lang_name'], $_POST['lang_code'], '', ''); echo htmlspecialchars(xl('Language definition added'), ENT_NOQUOTES) . '<br>'; } } ?> <TABLE> <FORM name="lang_form" METHOD=POST ACTION="?m=language" onsubmit="return top.restoreSession()"> <TR> <TD><?php echo htmlspecialchars(xl('Language Code'), ENT_NOQUOTES); ?> :</TD> <TD><INPUT TYPE="text" NAME="lang_code" size="2" maxlength="2" value="<?php echo htmlspecialchars($val_lang_code, ENT_QUOTES); ?>