merge with main, which has changes for improved mysql escape character processing
[openemr.git] / interface / globals.php
blob537906ceb94afa0327aa7d6f98896e7da90fca60
1 <?php
2 /* $Id$ */
3 // ------------------------------------------------------------------------ //
4 // OpenEMR Electronic Medical Records System //
5 // Copyright (c) 2005-2008 oemr.org //
6 // <http://www.oemr.org/> //
7 // ------------------------------------------------------------------------ //
8 // This program is free software; you can redistribute it and/or modify //
9 // it under the terms of the GNU General Public License as published by //
10 // the Free Software Foundation; either version 2 of the License, or //
11 // (at your option) any later version. //
12 // //
13 // You may not change or alter any portion of this comment or credits //
14 // of supporting developers from this source code or any supporting //
15 // source code which is considered copyrighted (c) material of the //
16 // original comment or credit authors. //
17 // //
18 // This program is distributed in the hope that it will be useful, //
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
21 // GNU General Public License for more details. //
22 // //
23 // You should have received a copy of the GNU General Public License //
24 // along with this program; if not, write to the Free Software //
25 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
26 // ------------------------------------------------------------------------ //
28 // Some important php.ini overrides. Defaults for these values are often
29 // too small. You might choose to adjust them further.
31 ini_set('memory_limit', '64M');
32 ini_set('session.gc_maxlifetime', '14400');
34 // Emulates register_globals = On. Moved to here from the bottom of this file
35 // to address security issues. Need to change everything requiring this!
36 $ps = strpos($_SERVER['REQUEST_URI'],"myadmin");
37 if ($ps === false) {
38 extract($_GET);
39 extract($_POST);
42 require_once(dirname(__FILE__) . "/../includes/config.php");
43 // Global variable file in which colors and paths are set for the interface.
44 ///////////////////////////////////////////////////////////////////
45 // THESE VALUES MUST BE SET BEFORE OPENEMR WILL FUNCTION:
46 ///////////////////////////////////////////////////////////////////
47 // Set this to the full absolute directory path for openemr:
48 $webserver_root = "/var/www/openemr";
50 // Set this to the relative html path, ie. what you would type into the web
51 // browser after the server address to get to OpenEMR. For example, if you
52 // type "http://127.0.0.1/clinic/openemr/" to load OpenEMR, set $web_root
53 // to "/clinic/openemr" without the trailing slash.
54 $web_root = "/openemr";
56 ///////////////////////////////////////////////////////////////////
58 // Collecting the utf8 disable flag from the sqlconf.php file in order
59 // to set the correct html encoding. utf8 vs iso-8859-1. If flag is set
60 // then set to iso-8859-1.
61 require_once(dirname(__FILE__) . "/../library/sqlconf.php");
62 if (!$disable_utf8_flag) {
63 ini_set('default_charset', 'utf-8');
65 else {
66 ini_set('default_charset', 'iso-8859-1');
69 // This is the return mail address used when sending prescriptions by email:
70 $GLOBALS['practice_return_email_path'] = "prescription_mail@example.com";
72 // Root directory, relative to the webserver root:
73 $GLOBALS['rootdir'] = "$web_root/interface";
74 // Absolute path to the source code include and headers file directory (Full path):
75 $GLOBALS['srcdir'] = "$webserver_root/library";
76 // Absolute path to the location of documentroot directory for use with include statements:
77 $GLOBALS['fileroot'] = "$webserver_root";
78 // Absolute path to the location of interface directory for use with include statements:
79 $include_root = "$webserver_root/interface";
80 // Absolute path to the location of documentroot directory for use with include statements:
81 $GLOBALS['webroot'] = $web_root;
83 $GLOBALS['template_dir'] = $GLOBALS['fileroot'] . "/templates/";
84 $GLOBALS['incdir'] = $include_root;
85 // Location of the login screen file
86 $GLOBALS['login_screen'] = "$rootdir/login_screen.php";
89 // Language Translations Control Section
92 // Current supported languages: // Allow capture of term for translation:
93 // Armenian // xl('Armenian')
94 // Bahasa Indonesia // xl('Bahasa Indonesia')
95 // Brazilian Portuguese // xl('Brazilian Portuguese')
96 // Chinese // xl('Chinese')
97 // Dutch // xl('Dutch')
98 // English (Indian) // xl('English (Indian)')
99 // English (Standard) // xl('English (Standard)')
100 // French // xl('French')
101 // German // xl('German')
102 // Greek // xl('Greek')
103 // Hebrew // xl('Hebrew')
104 // Norwegian // xl('Norwegian')
105 // Russian // xl('Russian')
106 // Slovak // xl('Slovak')
107 // Spanish // xl('Spanish')
108 // Swedish // xl('Swedish')
110 // Login Menu Language Translation Configuration
112 // 'language_menu_login' toggle
113 // -If set to true then will allow language selection on login
114 // -If set to false then will not show menu in login and will use default (see below)
115 $GLOBALS['language_menu_login'] = true;
117 // 'language_menu_all' toggle
118 // -If set to true then show all languages in login menu
119 // -If set to false then only show chosen (see below) languages in login menu
120 $GLOBALS['language_menu_showall'] = true;
122 // 'language_menu_show' array
123 // -ONLY pertinent if above 'language_menu_all' toggle is set to false
124 // -Displays these chosen languages in the login menu
125 $GLOBALS['language_menu_show'] = array('English (Standard)','Swedish');
127 // 'language_default'
128 // -Sets the default language
129 // -If login menu is on, then it will be the 'Default' choice in menu
130 // -If login menu is off, then it will choose this language
131 $GLOBALS['language_default'] = "English (Standard)";
133 // Language translation options
134 // -The globals below allow granular control to turn off translation of
135 // several specific parts of OpenEMR.
137 // 'translate_layout'
138 // -If true, then will translate the layout information.
139 // -If false, will not translate the layout information.
140 // If false, then most of the demographics and patient data
141 // entry forms will not be translated.
142 $GLOBALS['translate_layout'] = true;
144 // 'translate_lists'
145 // -If true, then will translate the lists information.
146 // -If false, will not translate the lists information.
147 // If false, then many lists of information in forms
148 // and templates will be untranslated.
149 $GLOBALS['translate_lists'] = true;
151 // 'translate_gacl_groups'
152 // -If true, then will translate the access control group names.
153 // -If false, will not translate the access control group names.
154 $GLOBALS['translate_gacl_groups'] = true;
156 // 'translate_note_titles'
157 // -If true, then will translate the patient Form (note) titles.
158 // -If false, will not translate the patient Form (note) titles.
159 $GLOBALS['translate_form_titles'] = true;
161 // 'translate_document_categories'
162 // -If true, then will translate the document categories.
163 // -If false, will not translate the document categories.
164 $GLOBALS['translate_document_categories'] = true;
166 // 'translate_appt_categories'
167 // -If true, then will translate the appt categories.
168 // -If false, will not translate the appt categories.
169 $GLOBALS['translate_appt_categories'] = true;
171 // Include the translation engine. This will also call sql.inc to
172 // open the openemr mysql connection.
173 include_once (dirname(__FILE__) . "/../library/translation.inc.php");
177 // Lists and Layouts Control Section
180 // 'state_custom_addlist_widget'
181 // - If true, then will display a customized addlist widget for
182 // state list entries (will ask for title and abbreviation)
183 $GLOBALS['state_custom_addlist_widget'] = true;
185 // Data type options. This will set data types in forms that are not
186 // covered by a layout.
187 // 1 = single-selection list
188 // 2 = text field
189 // 26 = single-selection list with ability to add to the list (addlist widget)
190 // (the list entries below are only pertinent for data types 1 or 26)
192 // 'state_data_type'
193 $GLOBALS['state_data_type'] = 26;
194 $GLOBALS['state_list'] = "state";
196 // 'country_data_type'
197 $GLOBALS['country_data_type'] = 26;
198 $GLOBALS['country_list'] = "country";
201 // Vitals form and growth chart units (US and-or metrics)
202 // 1 = Show both US and metric (main unit is US)
203 // 2 = Show both US and metric (main unit is metric)
204 // 3 = Show US only
205 // 4 = Show metric only
206 $GLOBALS['units_of_measurement'] = 1;
209 include_once (dirname(__FILE__) . "/../library/date_functions.php");
210 include_once (dirname(__FILE__) . "/../library/classes/Filtreatment_class.php");
212 // Default category for find_patient screen
213 $GLOBALS['default_category'] = 5;
214 $GLOBALS['default_event_title'] = 'Office Visit';
216 // The session name appears in cookies stored in the browser. If you have
217 // multiple OpenEMR installations running on the same server, you should
218 // customize this name so they cannot interfere with each other.
220 // Also, if modify session_name, then need to place the identical name in
221 // the phpmyadmin file here: openemr/phpmyadmin/libraries/session.inc.php
222 // at line 71. This was required after embedded new phpmyadmin version on
223 // 05-12-2009 by Brady. Hopefully will figure out a more appropriate fix.
224 session_name("OpenEMR");
226 session_start();
228 // Set this to 1 or 2 to activate support for the new frame layout.
229 // 0 = Old-style layout
230 // 1 = Navigation menu consists of pairs of radio buttons
231 // 2 = Navigation menu is a tree view
233 $GLOBALS['concurrent_layout'] = 2;
235 // If >0 this will enforce a separate PHP session for each top-level
236 // browser window. You must log in separately for each. This is not
237 // thoroughly tested yet and some browsers might have trouble with it,
238 // so make it 0 if you must. Alternatively, you can set it to 2 to be
239 // notified when the session ID changes.
240 $GLOBALS['restore_sessions'] = 1; // 0=no, 1=yes, 2=yes+debug
242 // used in Add new event for multiple providers
243 $GLOBALS['select_multi_providers'] = false;
245 // NOT functional. Always keep this value FALSE.
246 // Plan to remove when this functionally has been completely
247 // removed from code.
248 $GLOBALS['dutchpc'] = FALSE;
250 // Theme definition:
251 if ($GLOBALS['concurrent_layout']) {
252 $top_bg_line = ' bgcolor="#dddddd" ';
253 $GLOBALS['style']['BGCOLOR2'] = "#dddddd";
254 $bottom_bg_line = $top_bg_line;
255 $title_bg_line = ' bgcolor="#bbbbbb" ';
256 $nav_bg_line = ' bgcolor="#94d6e7" ';
257 } else {
258 $top_bg_line = ' bgcolor="#94d6e7" ';
259 $GLOBALS['style']['BGCOLOR2'] = "#94d6e7";
260 $bottom_bg_line = ' background="'.$rootdir.'/pic/aquabg.gif" ';
261 $title_bg_line = ' bgcolor="#aaffff" ';
262 $nav_bg_line = ' bgcolor="#94d6e7" ';
264 $login_filler_line = ' bgcolor="#f7f0d5" ';
265 $login_body_line = ' background="'.$rootdir.'/pic/aquabg.gif" ';
266 $css_header = "$rootdir/themes/style_sky_blue.css";
267 $logocode="<img src='$rootdir/pic/logo_sky.gif'>";
268 $linepic = "$rootdir/pic/repeat_vline9.gif";
269 $table_bg = ' bgcolor="#cccccc" ';
270 $GLOBALS['style']['BGCOLOR1'] = "#cccccc";
271 $GLOBALS['style']['TEXTCOLOR11'] = "#222222";
272 $GLOBALS['style']['HIGHLIGHTCOLOR'] = "#dddddd";
273 $GLOBALS['style']['BOTTOM_BG_LINE'] = $bottom_bg_line;
275 // The height in pixels of the Logo bar at the top of the login page:
276 $GLOBALS['logoBarHeight'] = 110;
277 // The height in pixels of the Navigation bar:
278 $GLOBALS['navBarHeight'] = 22;
279 // The height in pixels of the Title bar:
280 $GLOBALS['titleBarHeight'] = 20;
282 // The assistant word, MORE printed next to titles that can be clicked:
283 // Note this label gets translated here via the xl function
284 // -if you don't want it translated, then strip the xl function away
285 $tmore = xl('(More)');
286 // The assistant word, BACK printed next to titles that return to previous screens:
287 // Note this label gets translated here via the xl function
288 // -if you don't want it translated, then strip the xl function away
289 $tback = xl('(Back)');
291 // This is the idle logout function:
292 // if a page has not been refreshed within this many seconds, the interface
293 // will return to the login page
294 if (!empty($special_timeout)) {
295 $timeout = intval($special_timeout);
297 else {
298 // Max Idle Time in seconds before logout. Default 7200 (2 hours):
299 $timeout = 7200;
302 //Version tags
304 $v_major = '3';
305 $v_minor = '1';
306 $v_patch = '0';
307 $tag = '-dev'; // minor revision number, should be empty for production releases
309 // This name appears on the login page and in the title bar of most windows.
310 // It's nice to customize this to be the name of your clinic.
311 $openemr_name = 'OpenEMR';
313 $openemr_version = "$v_major.$v_minor.$v_patch".$tag; // Version tag used by program
315 $rootdir = $GLOBALS['rootdir'];
316 $srcdir = $GLOBALS['srcdir'];
317 $login_screen = $GLOBALS['login_screen'];
318 $GLOBALS['css_header'] = $css_header;
319 $GLOBALS['backpic'] = $backpic;
320 $GLOBALS['rootdir'] = $rootdir;
322 // change these to reflect when the daily view should start to display times
323 // as well as it should end. ex schedule_start = 9 schedule_end = 17
324 // start end times in hours
325 $GLOBALS['schedule_start'] = 8;
326 $GLOBALS['schedule_end'] = 17;
328 // This is the time granularity of the calendar and the smallest interval
329 // in minutes for an appointment slot:
330 $GLOBALS['calendar_interval'] = 15;
332 // Include the authentication module code here, but the rule is
333 // if the file has the word "login" in the source code file name,
334 // don't include the authentication module - we do this to avoid
335 // include loops.
337 if (!$ignoreAuth) {
338 include_once("$srcdir/auth.inc");
341 // If you do not want your accounting system to have a customer added to it
342 // for each insurance company, then set this to true. SQL-Ledger currently
343 // (2005-03-21) does nothing useful with insurance companies as customers.
344 $GLOBALS['insurance_companies_are_not_customers'] = true;
346 // If OpenEMR is being used by an athletic team rather than in a traditional
347 // clinical setting, set this to true.
348 $GLOBALS['athletic_team'] = false;
350 // True if this is a weight loss clinic:
351 $GLOBALS['weight_loss_clinic'] = false;
353 // The telephone country code of this installation. 1 = USA.
354 // See http://www.wtng.info/ for a list.
355 $GLOBALS['phone_country_code'] = '1';
357 // This determines how appointments display on the calendar:
358 // 1 = lastname; 2 = last,first; 3 = last,first(title);
359 // 4 = last,first(title: description)
360 $GLOBALS['calendar_appt_style'] = 2;
362 // Make this true if you want providers to see all appointments by default
363 // and not just their own.
364 $GLOBALS['docs_see_entire_calendar'] = false;
366 // Set this to true if you want the drug database and support for in-house
367 // prescription dispensing.
368 $GLOBALS['inhouse_pharmacy'] = false;
370 // Make this nonzero if you want the ability to sell products other than
371 // prescription drugs. Also requires inhouse_pharmacy to be true.
372 // This allows selection of products from the Fee Sheet.
373 // Set this to 2 if you want a simplified interface (no templates, no
374 // prescription drugs), otherwise to 1.
375 $GLOBALS['sell_non_drug_products'] = 0;
377 // True to omit insurance and some other things from the demographics form:
378 $GLOBALS['simplified_demographics'] = false;
380 // True to omit form, route and interval which then become part of dosage:
381 $GLOBALS['simplified_prescriptions'] = false;
383 // True to omit method of payment from the copay panel:
384 $GLOBALS['simplified_copay'] = false;
386 // You may put text here as the default complaint in the New Patient form:
387 $GLOBALS['default_chief_complaint'] = '';
389 // This was added for sports teams needing to fill out injury forms, but might
390 // have other applications.
391 $GLOBALS['default_new_encounter_form'] = '';
393 // If you want a new encounter to be automatically created when appointment
394 // status is set to "@" (arrived), then make this true.
395 $GLOBALS['auto_create_new_encounters'] = true;
397 // If you don't want employer information, country, title in patient demographics.
398 $GLOBALS['omit_employers'] = false;
400 // This is for insurance billing and is specific to Medicare. Make it true
401 // to force the referring provider to be the same as the rendering provider,
402 // instead of coming from the patient demographics.
403 $GLOBALS['MedicareReferrerIsRenderer'] = false;
405 // You can set this to the category name of a document to link to from the
406 // patient summary page. Normally this is the category for insurance cards.
407 // This lets you click on the patient's name to see their ID card.
408 $GLOBALS['patient_id_category_name'] = '';
410 // Traditionally OpenEMR has allowed creation of user groups (not the same
411 // as access control groups). However this has never done anything very
412 // useful and creates confusion. Make this false if you really want it.
413 $GLOBALS['disable_non_default_groups'] = true;
415 // These are flags for some installation-specific customizations for which
416 // we have not yet figured out better parameters.
417 $GLOBALS['ippf_specific'] = false;
418 $GLOBALS['cene_specific'] = false;
420 // True to support discounts in the Checkout form by dollars instead of percentage.
421 $GLOBALS['discount_by_money'] = false;
423 // Set this to false if you want the doctors to be prompted to authorize
424 // patient notes created by others.
425 $GLOBALS['ignore_pnotes_authorization'] = true;
427 // This turns on the option of creating a new patient using the complete
428 // layout of the demographics form as well as a built-in search feature.
429 // Everyone should want this, but for now it's optional.
430 $GLOBALS['full_new_patient_form'] = true;
432 // Restrict non-authorized users to the "Schedule Facilities" (aka user_facilities table)
433 // set in User admin.
434 $GLOBALS['restrict_user_facility'] = false;
436 // If you want Hylafax support then uncomment and customize the following
437 // statements, and also customize custom/faxcover.txt:
439 // $GLOBALS['hylafax_server'] = 'localhost';
440 // $GLOBALS['hylafax_basedir'] = '/var/spool/fax';
441 // $GLOBALS['hylafax_enscript'] = 'enscript -M Letter -B -e^ --margins=36:36:36:36';
443 // For scanner support, uncomment and customize the following. This is
444 // the directory in which scanned-in documents may be found, and may for
445 // example be a smbfs-mounted share from the PC supporting the scanner:
447 // $GLOBALS['scanner_output_directory'] = '/mnt/scan_docs';
449 // Customize these if you are using SQL-Ledger with OpenEMR, or if you are
450 // going to run sl_convert.php to convert from SQL-Ledger.
452 $sl_cash_acc = '1060'; // sql-ledger account number for checking account
453 $sl_ar_acc = '1200'; // sql-ledger account number for accounts receivable
454 $sl_income_acc = '4320'; // sql-ledger account number for medical services income
455 $sl_services_id = 'MS'; // sql-ledger parts table id for medical services
456 $sl_dbname = 'sql-ledger'; // sql-ledger database name
457 $sl_dbuser = 'sql-ledger'; // sql-ledger database login name
458 $sl_dbpass = 'secret'; // sql-ledger database login password
460 // Don't change anything below this line. ////////////////////////////
462 $encounter = empty($_SESSION['encounter']) ? 0 : $_SESSION['encounter'];
464 if (!empty($_GET['pid']) && empty($_SESSION['pid'])) {
465 $_SESSION['pid'] = $_GET['pid'];
467 elseif (!empty($_POST['pid']) && empty($_SESSION['pid'])) {
468 $_SESSION['pid'] = $_POST['pid'];
470 $pid = empty($_SESSION['pid']) ? 0 : $_SESSION['pid'];
471 $userauthorized = empty($_SESSION['userauthorized']) ? 0 : $_SESSION['userauthorized'];
472 $groupname = empty($_SESSION['authProvider']) ? 0 : $_SESSION['authProvider'];
474 // global interface function to format text length using ellipses
475 function strterm($string,$length) {
476 if (strlen($string) >= ($length-3)) {
477 return substr($string,0,$length-3) . "...";
478 } else {
479 return $string;
483 // turn off PHP compatibility warnings
484 ini_set("session.bug_compat_warn","off");
486 //settings for cronjob
487 // SEND SMS NOTIFICATION BEFORE HH HOUR
488 $SMS_NOTIFICATION_HOUR = 50;
489 // SEND EMAIL NOTIFICATION BEFORE HH HOUR
490 $EMAIL_NOTIFICATION_HOUR = 50;
491 $SMS_GATEWAY_USENAME = 'SMS_GATEWAY_USENAME';
492 $SMS_GATEWAY_PASSWORD = 'SMS_GATEWAY_PASSWORD';
493 $SMS_GATEWAY_APIKEY = 'SMS_GATEWAY_APIKEY';