5 * LICENSE: This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
17 * @author Rod Roark <rod@sunsetsystems.com>
18 * @author Brady Miller <brady.g.miller@gmail.com>
19 * @author Kevin Yeh <kevin.y@integralemr.com>
20 * @author Scott Wakefield <scott.wakefield@gmail.com>
21 * @author ViCarePlus <visolve_emr@visolve.com>
22 * @author Julia Longtin <julialongtin@diasp.org>
25 * @link http://www.open-emr.org
30 use OpenEMR\Core\Header
;
33 require_once("../globals.php");
35 // mdsupport - Add 'App' functionality for user interfaces without standard menu and frames
36 // If this script is called with app parameter, validate it without showing other apps.
38 // Build a list of valid entries
40 if ($GLOBALS['new_tabs_layout']) {
42 "SELECT option_id, title,is_default FROM list_options
43 WHERE list_id=? and activity=1 ORDER BY seq, option_id",
46 if (sqlNumRows($rs)) {
47 while ($app = sqlFetchArray($rs)) {
48 $app_req = explode('?', trim($app['title']));
49 if (! file_exists('../'.$app_req[0])) {
53 $emr_app [trim($app ['option_id'])] = trim($app ['title']);
54 if ($app ['is_default']) {
55 $emr_app_def = $app ['option_id'];
62 if (count($emr_app)) {
63 // Standard app must exist
64 $std_app = 'main/main_screen.php';
65 if (!in_array($std_app, $emr_app)) {
66 $emr_app['*OpenEMR'] = $std_app;
69 if (isset($_REQUEST['app']) && $emr_app[$_REQUEST['app']]) {
70 $div_app = sprintf('<input type="hidden" name="appChoice" value="%s">', attr($_REQUEST['app']));
72 foreach ($emr_app as $opt_disp => $opt_value) {
74 '<option value="%s" %s>%s</option>\n',
76 ($opt_disp == $opt_default ?
'selected="selected"' : ''),
77 text(xl_list_label($opt_disp))
83 <div id="divApp" class="form-group">
84 <label for="appChoice" class="control-label text-right">%s:</label>
86 <select class="form-control" id="selApp" name="appChoice" size="1">%s</select>
98 <title
><?php
echo text($openemr_name) . " " . xlt('Login'); ?
></title
>
99 <meta http
-equiv
="X-UA-Compatible" content
="IE=edge" />
101 <?php Header
::setupHeader(['jquery-ui', 'jquery-ui-darkness']); ?
>
103 <link rel
="stylesheet" href
="../themes/login.css?v=<?php echo $v_js_includes; ?>" type
="text/css">
105 <link rel
="shortcut icon" href
="<?php echo $GLOBALS['images_static_relative']; ?>/favicon.ico" />
107 <script type
="text/javascript">
108 var registrationTranslations
= <?php
echo json_encode(array(
109 'title' => xla('OpenEMR Product Registration'),
110 'pleaseProvideValidEmail' => xla('Please provide a valid email address'),
111 'success' => xla('Success'),
112 'registeredSuccess' => xla('Your installation of OpenEMR has been registered'),
113 'submit' => xla('Submit'),
114 'noThanks' => xla('No Thanks'),
115 'registeredEmail' => xla('Registered email'),
116 'registeredId' => xla('Registered id'),
117 'genericError' => xla('Error. Try again later'),
122 var registrationConstants
= <?php
echo json_encode(array(
123 'webroot' => $GLOBALS['webroot']
128 <script type
="text/javascript" src
="<?php echo $webroot ?>/interface/product_registration/product_registration_service.js?v=<?php echo $v_js_includes; ?>"></script
>
129 <script type
="text/javascript" src
="<?php echo $webroot ?>/interface/product_registration/product_registration_controller.js?v=<?php echo $v_js_includes; ?>"></script
>
131 <script type
="text/javascript">
132 jQuery(document
).ready(function() {
135 var productRegistrationController
= new ProductRegistrationController();
136 productRegistrationController
.getProductRegistrationStatus(function(err
, data
) {
139 if (data
.statusAsString
=== 'UNREGISTERED') {
140 productRegistrationController
.showProductRegistrationModal();
146 $
("#authUser").focus();
149 function transmit_form() {
150 document
.forms
[0].submit();
153 function imsubmitted() {
154 <?php
if (!empty($GLOBALS['restore_sessions'])) { ?
>
155 // Delete the session cookie by setting its expiration date in the past.
156 // This forces the server to create a new session ID.
157 var olddate
= new Date();
158 olddate
.setFullYear(olddate
.getFullYear() - 1);
159 document
.cookie
= '<?php echo session_name() . '=' . session_id() ?>; path=<?php echo($web_root ? $web_root : '/');?>; expires=' + olddate
.toGMTString();
161 return false; //Currently the submit action is handled by the encrypt_form().
167 <div
class="container">
168 <form method
="POST" id
="login_form"
169 action
="../main/main_screen.php?auth=login&site=<?php echo attr($_SESSION['site_id']); ?>"
170 target
="_top" name
="login_form" onsubmit
="return imsubmitted();">
172 <div
class="col-sm-12">
174 <div
class="center-block" style
="max-width:400px">
175 <img
class="img-fluid img-responsive center-block" src
="<?php echo $GLOBALS['images_static_relative']; ?>/login-logo.png" />
178 <input type
='hidden' name
='new_login_session_management' value
='1' />
182 $res = sqlStatement("select distinct name from `groups`");
183 for ($iter = 0; $row = sqlFetchArray($res); $iter++
) {
184 $result[$iter] = $row;
187 if (count($result) == 1) {
188 $resvalue = $result[0]{"name"};
189 echo "<input type='hidden' name='authProvider' value='" . attr($resvalue) . "' />\n";
192 // collect default language id
193 $res2 = sqlStatement("select * from lang_languages where lang_description = ?", array($GLOBALS['language_default']));
194 for ($iter = 0; $row = sqlFetchArray($res2); $iter++
) {
195 $result2[$iter] = $row;
198 if (count($result2) == 1) {
199 $defaultLangID = $result2[0]{"lang_id"};
200 $defaultLangName = $result2[0]{"lang_description"};
202 //default to english if any problems
204 $defaultLangName = "English";
207 // set session variable to default so login information appears in default language
208 $_SESSION['language_choice'] = $defaultLangID;
209 // collect languages if showing language menu
210 if ($GLOBALS['language_menu_login']) {
211 // sorting order of language titles depends on language translation options.
212 $mainLangID = empty($_SESSION['language_choice']) ?
'1' : $_SESSION['language_choice'];
213 if ($mainLangID == '1' && !empty($GLOBALS['skip_english_translation'])) {
214 $sql = "SELECT *,lang_description as trans_lang_description FROM lang_languages ORDER BY lang_description, lang_id";
215 $res3=SqlStatement($sql);
217 // Use and sort by the translated language name.
218 $sql = "SELECT ll.lang_id, " .
219 "IF(LENGTH(ld.definition),ld.definition,ll.lang_description) AS trans_lang_description, " .
220 "ll.lang_description " .
221 "FROM lang_languages AS ll " .
222 "LEFT JOIN lang_constants AS lc ON lc.constant_name = ll.lang_description " .
223 "LEFT JOIN lang_definitions AS ld ON ld.cons_id = lc.cons_id AND " .
225 "ORDER BY IF(LENGTH(ld.definition),ld.definition,ll.lang_description), ll.lang_id";
226 $res3=SqlStatement($sql, array($mainLangID));
229 for ($iter = 0; $row = sqlFetchArray($res3); $iter++
) {
230 $result3[$iter] = $row;
233 if (count($result3) == 1) {
234 //default to english if only return one language
235 echo "<input type='hidden' name='languageChoice' value='1' />\n";
238 echo "<input type='hidden' name='languageChoice' value='".attr($defaultLangID)."' />\n";
245 <div
class="col-sm-12">
246 <?php
if (isset($_SESSION['relogin']) && ($_SESSION['relogin'] == 1)) : // Begin relogin dialog ?>
247 <div
class="alert alert-info m-1">
249 <?php
echo xlt('Password security has recently been upgraded.').' '.xlt('Please login again.'); ?
>
252 <?php
unset($_SESSION['relogin']);
254 if (isset($_SESSION['loginfailure']) && ($_SESSION['loginfailure'] == 1)) : // Begin login failure block ?>
255 <div
class="alert alert-danger login-failure m-1">
256 <?php
echo xlt('Invalid username or password'); ?
>
258 <?php
endif; // End login failure block?>
263 $extraLogo = $GLOBALS['extra_logo_login'];
264 $loginFormColumnCount = ($extraLogo == 1) ?
'6' : '12';
266 <?php
if ($extraLogo) : ?
>
267 <div
class="col-sm-6">
268 <?php
echo $logocode; ?
>
271 <div
class="col-sm-<?php echo $loginFormColumnCount;?>">
273 <div
class="center-block login-title-label">
274 <?php
if ($GLOBALS['show_label_login']) : ?
>
275 <?php
echo text($openemr_name); ?
>
279 // Figure out how to display the tiny logos
280 $t1 = $GLOBALS['tiny_logo_1'];
281 $t2 = $GLOBALS['tiny_logo_2'];
282 if ($t1 && !$t2) : ?
>
283 <div
class="col-sm-12 center-block">
284 <?php
echo $tinylogocode1; ?
>
288 if ($t2 && !$t1) : ?
>
289 <div
class="col-sm-12 center-block">
290 <?php
echo $tinylogocode2; ?
>
295 <div
class="col-sm-6 center-block"><?php
echo $tinylogocode1;?
></div
>
296 <div
class="col-sm-6 center-block"><?php
echo $tinylogocode2;?
></div
>
301 <?php
if (count($result) > 1) : // Begin Display check for groups ?>
302 <div
class="form-group">
303 <label
for="group" class="control-label text-right"><?php
echo xlt('Group:'); ?
></label
>
305 <select name
="authProvider" class="form-control">
307 foreach ($result as $iter) {
308 echo "<option value='".attr($iter{"name"})."'>".text($iter{"name"})."</option>\n";
314 <?php
endif; // End Display check for groups ?>
315 <div
class="form-group">
316 <label
for="authUser" class="control-label text-right"><?php
echo xlt('Username:'); ?
></label
>
317 <input type
="text" class="form-control" id
="authUser" name
="authUser" placeholder
="<?php echo xla('Username:'); ?>">
319 <div
class="form-group">
320 <label
for="clearPass" class="control-label text-right"><?php
echo xlt('Password:'); ?
></label
>
321 <input type
="password" class="form-control" id
="clearPass" name
="clearPass" placeholder
="<?php echo xla('Password:'); ?>">
323 <?php
echo $div_app ?
>
324 <?php
if ($GLOBALS['language_menu_login'] && (count($result3) != 1)) : // Begin language menu block ?>
325 <div
class="form-group">
326 <label
for="language" class="control-label text-right"><?php
echo xlt('Language'); ?
>:</label
>
328 <select
class="form-control" name
="languageChoice" size
="1">
330 echo "<option selected='selected' value='" . attr($defaultLangID) . "'>" . xlt('Default') . " - " . xlt($defaultLangName) . "</option>\n";
331 foreach ($result3 as $iter) :
332 if ($GLOBALS['language_menu_showall']) {
333 if (!$GLOBALS['allow_debug_language'] && $iter['lang_description'] == 'dummy') {
334 continue; // skip the dummy language
337 echo "<option value='".attr($iter['lang_id'])."'>".text($iter['trans_lang_description'])."</option>\n";
339 if (in_array($iter['lang_description'], $GLOBALS['language_menu_show'])) {
340 if (!$GLOBALS['allow_debug_language'] && $iter['lang_description'] == 'dummy') {
341 continue; // skip the dummy language
344 echo "<option value='".attr($iter['lang_id'])."'>" . text($iter['trans_lang_description']) . "</option>\n";
351 <?php
endif; // End language menu block ?>
352 <div
class="form-group pull-right">
353 <button type
="submit" class="btn btn-default btn-lg" onClick
="transmit_form()"><i
class="fa fa-sign-in"></i
> 
; 
;<?php
echo xlt('Login');?
></button
>
356 <div
class="col-sm-12 text-center">
358 <a href
="../../acknowledge_license_cert.html" target
="main"><?php
echo xlt('Acknowledgments, Licensing and Certification'); ?
></a
>
361 <div
class="product-registration-modal" style
="display: none">
362 <p
class="context"><?php
echo xlt("Register your installation with OEMR to receive important notifications, such as security fixes and new release announcements."); ?
></p
>
363 <input placeholder
="<?php echo xlt('email'); ?>" type
="email" class="email" style
="width: 100%; color: black" />
364 <p
class="message" style
="font-style: italic"></p
>