chore: complete integration of flex-3.20 (alpine 3.20) into ci (#7538)
[openemr.git] / interface / language / lang_constant.php
blob596499ffeaacc977eb3f3fe43667fcf7f182816f
1 <?php
3 /**
4 * lang_constant.php script
6 * @package OpenEMR
7 * @link http://www.open-emr.org
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
10 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 require_once("language.inc.php");
15 use OpenEMR\Common\Acl\AclMain;
16 use OpenEMR\Common\Csrf\CsrfUtils;
18 // Ensure this script is not called separately
19 if ($langModuleFlag !== true) {
20 die(function_exists('xlt') ? xlt('Authentication Error') : 'Authentication Error');
23 // gacl control
24 $thisauth = AclMain::aclCheckCore('admin', 'language');
25 if (!$thisauth) {
26 echo "<html>\n<body>\n";
27 echo "<p>" . xlt('You are not authorized for this.') . "</p>\n";
28 echo "</body>\n</html>\n";
29 exit();
32 if (!empty($_POST['add'])) {
33 if (!CsrfUtils::verifyCsrfToken($_POST["csrf_token_form"])) {
34 CsrfUtils::csrfNotVerified();
37 //validate
38 if ($_POST['constant_name'] == "") {
39 echo xlt('Constant name is blank') . '<br />';
40 $err = 'y';
43 $sql = "SELECT * FROM lang_constants WHERE constant_name=? limit 1" ;
44 $res = SqlQuery($sql, array($_POST['constant_name']));
45 if ($res) {
46 echo xlt('Data Alike is already in database, please change constant name') . '<br />';
47 $err = 'y';
50 if (!empty($err) && ($err == 'y')) {
51 $val_constant = $_POST['constant_name'];
52 } else {
53 //insert into the main table
54 $sql = "INSERT INTO lang_constants SET constant_name=?";
55 SqlStatement($sql, array($_POST['constant_name']));
57 //insert into the log table - to allow persistant customizations
58 insert_language_log('', '', $_POST['constant_name'], '');
60 echo xlt('Constant') . ' ' . text($_POST['constant_name']) . ' ' . xlt('added') . '<br />';
65 // echo "$sql here ";
70 <form name="cons_form" method="post" action="?m=constant&csrf_token_form=<?php echo attr_url(CsrfUtils::collectCsrfToken()); ?>" onsubmit="return top.restoreSession()">
71 <input type="hidden" name="csrf_token_form" value="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
72 <!-- Constant Name -->
73 <div class="form-group">
74 <label for="constantName"><?php echo xlt('Constant Name'); ?>:</label>
75 <input type="text" class="form-control" id="constantName" name="constant_name" size="100" value="<?php echo attr($val_constant ?? ''); ?>">
76 </div>
77 <!-- Submit Button -->
78 <div class="form-group">
79 <input type="submit" class="btn btn-primary" name="add" value="<?php echo xla('Add'); ?>">
80 </div>
81 </form>
83 <span class="text"><?php echo xlt('Please Note: constants are case sensitive and any string is allowed.'); ?></span>
85 <?php echo activate_lang_tab('constant-link'); ?>