.inc files migration to .inc.php (#5897)
[openemr.git] / interface / language / language.php
blob7014f05df99c855340956719bf089d532d0c5f9e
1 <?php
3 /**
4 * language.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("../globals.php");
14 require_once("$srcdir/registry.inc.php");
15 require_once("language.inc.php");
17 use OpenEMR\Common\Csrf\CsrfUtils;
18 use OpenEMR\Core\Header;
20 // Generates a Javascript section to activate the specified tab.
21 function activate_lang_tab($linkid)
23 $s = "<script>\n";
24 foreach (
25 array(
26 'language-link',
27 'definition-link',
28 'constant-link',
29 'manage-link',
30 'csv-link',
31 ) as $id
32 ) {
33 $s .= "\$('#$id')." . ($id == $linkid ? 'addClass' : 'removeClass') . "('active');\n";
35 $s .= "</script>\n";
36 return $s;
39 //START OUT OUR PAGE....
41 <html>
42 <head>
43 <?php Header::setupHeader(['knockout']); ?>
44 </head>
46 <body class="body_top">
47 <div id="container_div" class="container">
48 <div class="row">
49 <div class="col-sm-12">
50 <div class="clearfix">
51 <h2 class="title"><?php echo xlt('Multi Language Tool'); ?></h2>
52 </div>
53 </div>
54 </div><!--end of header div-->
55 <div class="container-fluid mb-3">
56 <form name='translation' id='translation' method='get' action='language.php' onsubmit="return top.restoreSession()">
57 <input type="hidden" name="csrf_token_form" value="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
58 <input type='hidden' name='m' value='<?php echo attr($_GET['m'] ?? ''); ?>' />
59 <input type='hidden' name='edit' value='<?php echo attr($_GET['edit'] ?? ''); ?>' />
60 <!-- <span class="title"><?php echo xlt('Multi Language Tool'); ?></span> -->
61 <ui class="nav nav-pills">
62 <li class="nav-item" id="li-definition">
63 <a href="?m=definition&csrf_token_form=<?php echo attr_url(CsrfUtils::collectCsrfToken()); ?>" onclick="top.restoreSession()" class="nav-link font-weight-bold" id="definition-link"><?php echo xlt('Edit Definitions'); ?></a>
64 </li>
65 <li class="nav-item" id="li-language">
66 <a href="?m=language&csrf_token_form=<?php echo attr_url(CsrfUtils::collectCsrfToken()); ?>" onclick="top.restoreSession()" class="nav-link font-weight-bold" id="language-link"><?php echo xlt('Add Language'); ?></a>
67 </li>
68 <li class="nav-item" id="li-constant">
69 <a href="?m=constant&csrf_token_form=<?php echo attr_url(CsrfUtils::collectCsrfToken()); ?>" onclick="top.restoreSession()" class="nav-link font-weight-bold" id="constant-link"><?php echo xlt('Add Constant'); ?></a>
70 </li>
71 <li class="nav-item" id="li-manage">
72 <a href="?m=manage&csrf_token_form=<?php echo attr_url(CsrfUtils::collectCsrfToken()); ?>" onclick="top.restoreSession()" class="nav-link font-weight-bold" id="manage-link"><?php echo xlt('Manage Translations'); ?></a>
73 </li>
74 <li class="nav-item" id="li-csv">
75 <a href="?m=csv&csrf_token_form=<?php echo attr_url(CsrfUtils::collectCsrfToken()); ?>" onclick="top.restoreSession()" class="nav-link font-weight-bold" id="csv-link"><?php echo xlt('Load from CSV'); ?></a>
76 </li>
77 </ui>
78 </form>
79 </div><!--end of nav-pills div-->
80 <div class="row">
81 <div class="col-sm-12">
82 <div class="jumbotron jumbotron-fluid py-3">
83 <div class="col-sm-12 col-md-12 col-lg-12">
84 <?php
85 if (!empty($_GET['m'])) {
86 if (!CsrfUtils::verifyCsrfToken($_GET["csrf_token_form"])) {
87 CsrfUtils::csrfNotVerified();
90 // Set a variable, so below scripts can
91 // not be run on their own
92 $langModuleFlag = true;
94 switch ($_GET['m']) :
95 case 'definition':
96 require_once('lang_definition.php');
97 break;
98 case 'constant':
99 require_once('lang_constant.php');
100 break;
101 case 'language':
102 require_once('lang_language.php');
103 break;
104 case 'manage':
105 require_once('lang_manage.php');
106 break;
107 case 'csv':
108 require_once('csv/load_csv_file.php');
109 break;
110 case 'csvval':
111 require_once('csv/validate_csv.php');
112 break;
113 endswitch;
114 } else {
115 // If m is parameter empty, To autoload Edit Definitions page content
116 echo('<script>$(function () {$("#definition-link").get(0).click();});</script>');
119 </div>
120 </div>
121 </div><!--end of page content div-->
122 <br>
123 <a href="lang.info.html" class="text-decoration-none" target="_blank"><?php echo xlt('Info'); ?></a>
124 </div>
126 </body>
127 </html>