2 // Copyright (C) 2011 Cassian LUP <cassi.lup@gmail.com>
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 //setting the session & other config options
12 //don't require standard openemr authorization in globals.php
15 //SANITIZE ALL ESCAPES
16 $fake_register_globals=false;
18 //STOP FAKE REGISTER GLOBALS
19 $sanitize_all_escapes=true;
22 require_once('../interface/globals.php');
24 ini_set("error_log",E_ERROR || ~E_NOTICE
);
25 //exit if portal is turned off
26 if ( !(isset($GLOBALS['portal_onsite_enable'])) ||
!($GLOBALS['portal_onsite_enable']) ) {
27 echo htmlspecialchars( xl('Patient Portal is turned off'), ENT_NOQUOTES
);
31 // security measure -- will check on next page.
32 $_SESSION['itsme'] = 1;
36 // Deal with language selection
38 // collect default language id (skip this if this is a password update)
39 if (!(isset($_SESSION['password_update']))) {
40 $res2 = sqlStatement("select * from lang_languages where lang_description = ?", array($GLOBALS['language_default']) );
41 for ($iter = 0;$row = sqlFetchArray($res2);$iter++
) {
42 $result2[$iter] = $row;
44 if (count($result2) == 1) {
45 $defaultLangID = $result2[0]{"lang_id"};
46 $defaultLangName = $result2[0]{"lang_description"};
49 //default to english if any problems
51 $defaultLangName = "English";
53 // set session variable to default so login information appears in default language
54 $_SESSION['language_choice'] = $defaultLangID;
55 // collect languages if showing language menu
56 if ($GLOBALS['language_menu_login']) {
57 // sorting order of language titles depends on language translation options.
58 $mainLangID = empty($_SESSION['language_choice']) ?
'1' : $_SESSION['language_choice'];
59 if ($mainLangID == '1' && !empty($GLOBALS['skip_english_translation'])) {
60 $sql = "SELECT * FROM lang_languages ORDER BY lang_description, lang_id";
61 $res3=SqlStatement($sql);
64 // Use and sort by the translated language name.
65 $sql = "SELECT ll.lang_id, " .
66 "IF(LENGTH(ld.definition),ld.definition,ll.lang_description) AS trans_lang_description, " .
67 "ll.lang_description " .
68 "FROM lang_languages AS ll " .
69 "LEFT JOIN lang_constants AS lc ON lc.constant_name = ll.lang_description " .
70 "LEFT JOIN lang_definitions AS ld ON ld.cons_id = lc.cons_id AND " .
72 "ORDER BY IF(LENGTH(ld.definition),ld.definition,ll.lang_description), ll.lang_id";
73 $res3=SqlStatement($sql, array($mainLangID) );
75 for ($iter = 0;$row = sqlFetchArray($res3);$iter++
) {
76 $result3[$iter] = $row;
78 if (count($result3) == 1) {
79 //default to english if only return one language
80 $hiddenLanguageField = "<input type='hidden' name='languageChoice' value='1' />\n";
84 $hiddenLanguageField = "<input type='hidden' name='languageChoice' value='".htmlspecialchars($defaultLangID,ENT_QUOTES
)."' />\n";
92 <title
><?php
echo xlt('Patient Portal Login'); ?
></title
>
94 <script type
="text/javascript" src
="../library/js/jquery-1.5.js"></script
>
95 <script type
="text/javascript" src
="../library/js/jquery.gritter.min.js"></script
>
97 <link rel
="stylesheet" type
="text/css" href
="css/jquery.gritter.css" />
98 <link rel
="stylesheet" type
="text/css" href
="css/base.css" />
100 <script type
="text/javascript">
104 alert ('<?php echo addslashes( xl('Field(s
) are missing
!') ); ?>');
108 function validate() {
110 if (document
.getElementById('uname').value
== "") {
111 document
.getElementById('uname').style
.border
= "1px solid red";
114 if (document
.getElementById('pass').value
== "") {
115 document
.getElementById('pass').style
.border
= "1px solid red";
120 function process_new_pass() {
122 if (!(validate_new_pass())) {
123 alert ('<?php echo addslashes( xl('Field(s
) are missing
!') ); ?>');
126 if (document
.getElementById('pass_new').value
!= document
.getElementById('pass_new_confirm').value
) {
127 alert ('<?php echo addslashes( xl('The
new password fields are not the same
.') ); ?>');
130 if (document
.getElementById('pass').value
== document
.getElementById('pass_new').value
) {
131 alert ('<?php echo addslashes( xl('The
new password can not be the same
as the current password
.') ); ?>');
136 function validate_new_pass() {
138 if (document
.getElementById('uname').value
== "") {
139 document
.getElementById('uname').style
.border
= "1px solid red";
142 if (document
.getElementById('pass').value
== "") {
143 document
.getElementById('pass').style
.border
= "1px solid red";
146 if (document
.getElementById('pass_new').value
== "") {
147 document
.getElementById('pass_new').style
.border
= "1px solid red";
150 if (document
.getElementById('pass_new_confirm').value
== "") {
151 document
.getElementById('pass_new_confirm').style
.border
= "1px solid red";
157 <style type
="text/css">
159 font
-family
: sans
-serif
;
160 background
-color
: #638fd0;
162 background
: -webkit
-radial
-gradient(circle
, white
, #638fd0);
163 background
: -moz
-radial
-gradient(circle
, white
, #638fd0);
174 <?php
if (isset($_SESSION['password_update'])||
isset($_GET['password_update'])) {
175 $_SESSION['password_update']=1;
177 <div id
="wrapper" class="centerwrapper">
178 <h2
class="title"><?php
echo htmlspecialchars( xl('Please Enter a New Password'), ENT_NOQUOTES
); ?
></h2
>
179 <form action
="get_patient_info.php" method
="POST" onsubmit
="return process_new_pass()" >
182 <td
class="algnRight"><?php
echo htmlspecialchars( xl('User Name'), ENT_NOQUOTES
); ?
></td
>
183 <td
><input name
="uname" id
="uname" type
="text" autocomplete
="off" value
="<?php echo attr($_SESSION['portal_username']); ?>"/></td
>
186 <td
class="algnRight"><?php
echo htmlspecialchars( xl('Current Password'), ENT_NOQUOTES
);?
></>
188 <input name
="pass" id
="pass" type
="password" autocomplete
="off" />
192 <td
class="algnRight"><?php
echo htmlspecialchars( xl('New Password'), ENT_NOQUOTES
);?
></>
194 <input name
="pass_new" id
="pass_new" type
="password" />
198 <td
class="algnRight"><?php
echo htmlspecialchars( xl('Confirm New Password'), ENT_NOQUOTES
);?
></>
200 <input name
="pass_new_confirm" id
="pass_new_confirm" type
="password" />
204 <td colspan
=2><br
><center
><input type
="submit" value
="<?php echo htmlspecialchars( xl('Log In'), ENT_QUOTES);?>" /></center
></td
>
209 <div
class="copyright"><?php
echo htmlspecialchars( xl('Powered by'), ENT_NOQUOTES
);?
> OpenEMR
</div
>
212 <div id
="wrapper" class="centerwrapper">
213 <h2
class="title"><?php
echo htmlspecialchars( xl('Patient Portal Login'), ENT_NOQUOTES
); ?
></h2
>
214 <form action
="get_patient_info.php" method
="POST" onsubmit
="return process()" >
217 <td
class="algnRight"><?php
echo htmlspecialchars( xl('User Name'), ENT_NOQUOTES
); ?
></td
>
218 <td
><input name
="uname" id
="uname" type
="text" autocomplete
="off" /></td
>
221 <td
class="algnRight"><?php
echo htmlspecialchars( xl('Password'), ENT_NOQUOTES
);?
></>
223 <input name
="pass" id
="pass" type
="password" autocomplete
="off" />
227 <?php
if ($GLOBALS['language_menu_login']) { ?
>
228 <?php
if (count($result3) != 1) { ?
>
230 <td
><span
class="text"><?php
echo htmlspecialchars( xl('Language'), ENT_NOQUOTES
); ?
></span
></td
>
232 <select name
=languageChoice size
="1">
234 echo "<option selected='selected' value='".htmlspecialchars($defaultLangID,ENT_QUOTES
)."'>" . htmlspecialchars( xl('Default') . " - " . xl($defaultLangName), ENT_NOQUOTES
) . "</option>\n";
235 foreach ($result3 as $iter) {
236 if ($GLOBALS['language_menu_showall']) {
237 if ( !$GLOBALS['allow_debug_language'] && $iter[lang_description
] == 'dummy') continue; // skip the dummy language
238 echo "<option value='".htmlspecialchars($iter[lang_id
],ENT_QUOTES
)."'>".htmlspecialchars($iter[trans_lang_description
],ENT_NOQUOTES
)."</option>\n";
241 if (in_array($iter[lang_description
], $GLOBALS['language_menu_show'])) {
242 if ( !$GLOBALS['allow_debug_language'] && $iter[lang_description
] == 'dummy') continue; // skip the dummy language
243 echo "<option value='".htmlspecialchars($iter[lang_id
],ENT_QUOTES
)."'>".htmlspecialchars($iter[trans_lang_description
],ENT_NOQUOTES
)."</option>\n";
254 <td colspan
=2><br
><center
><input type
="submit" value
="<?php echo htmlspecialchars( xl('Log In'), ENT_QUOTES);?>" /></center
></td
>
257 <?php
if (!(empty($hiddenLanguageField))) echo $hiddenLanguageField; ?
>
260 <div
class="copyright"><?php
echo htmlspecialchars( xl('Powered by'), ENT_NOQUOTES
);?
> OpenEMR
</div
>
266 <script type
="text/javascript">
267 $
(document
).ready(function() {
269 <?php
// if something went wrong
270 if (isset($_GET['w'])) { ?
>
271 var unique_id
= $
.gritter
.add({
272 title
: '<span class="red"><?php echo htmlspecialchars( xl('Oops
!'), ENT_QUOTES);?></span>',
273 text
: '<?php echo htmlspecialchars( xl('Something went wrong
. Please
try again
.', ENT_QUOTES)); ?>',
276 class_name
: 'my-nonsticky-class'
280 <?php
// if successfully logged out
281 if (isset($_GET['logout'])) { ?
>
282 var unique_id
= $
.gritter
.add({
283 title
: '<span class="green"><?php echo htmlspecialchars( xl('Success
'), ENT_QUOTES);?></span>',
284 text
: '<?php echo htmlspecialchars( xl('You have been successfully logged out
.'), ENT_QUOTES);?>',
287 class_name
: 'my-nonsticky-class'