Some requested security fixes.
[openemr.git] / interface / usergroup / facilities.php
blobadb2ca05201b4d76e4ab38835c210b7e91140fc5
1 <?php
2 require_once("../globals.php");
3 require_once("../../library/acl.inc");
4 require_once("$srcdir/sql.inc");
5 require_once("$srcdir/formdata.inc.php");
7 $alertmsg = '';
9 /* Inserting New facility */
10 if (isset($_POST["mode"]) && $_POST["mode"] == "facility" && $_POST["newmode"] != "admin_facility") {
11 $insert_id=sqlInsert("INSERT INTO facility SET " .
12 "name = '" . trim(formData('facility' )) . "', " .
13 "phone = '" . trim(formData('phone' )) . "', " .
14 "fax = '" . trim(formData('fax' )) . "', " .
15 "street = '" . trim(formData('street' )) . "', " .
16 "city = '" . trim(formData('city' )) . "', " .
17 "state = '" . trim(formData('state' )) . "', " .
18 "postal_code = '" . trim(formData('postal_code' )) . "', " .
19 "country_code = '" . trim(formData('country_code')) . "', " .
20 "federal_ein = '" . trim(formData('federal_ein' )) . "', " .
21 "website = '" . trim(formData('website' )) . "', " .
22 "email = '" . trim(formData('email' )) . "', " .
23 "color = '" . trim(formData('ncolor' )) . "', " .
24 "service_location = '" . trim(formData('service_location' )) . "', " .
25 "billing_location = '" . trim(formData('billing_location' )) . "', " .
26 "accepts_assignment = '" . trim(formData('accepts_assignment' )) . "', " .
27 "pos_code = '" . trim(formData('pos_code' )) . "', " .
28 "domain_identifier = '" . trim(formData('domain_identifier' )) . "', " .
29 "attn = '" . trim(formData('attn' )) . "', " .
30 "tax_id_type = '" . trim(formData('tax_id_type' )) . "', " .
31 "primary_business_entity = '" . trim(formData('primary_business_entity' )) . "', ".
32 "facility_npi = '" . trim(formData('facility_npi')) . "'");
35 /* Editing existing facility */
36 if ($_POST["mode"] == "facility" && $_POST["newmode"] == "admin_facility")
38 sqlStatement("update facility set
39 name='" . trim(formData('facility')) . "',
40 phone='" . trim(formData('phone')) . "',
41 fax='" . trim(formData('fax')) . "',
42 street='" . trim(formData('street')) . "',
43 city='" . trim(formData('city')) . "',
44 state='" . trim(formData('state')) . "',
45 postal_code='" . trim(formData('postal_code')) . "',
46 country_code='" . trim(formData('country_code')) . "',
47 federal_ein='" . trim(formData('federal_ein')) . "',
48 website='" . trim(formData('website')) . "',
49 email='" . trim(formData('email')) . "',
50 color='" . trim(formData('ncolor')) . "',
51 service_location='" . trim(formData('service_location')) . "',
52 billing_location='" . trim(formData('billing_location')) . "',
53 accepts_assignment='" . trim(formData('accepts_assignment')) . "',
54 pos_code='" . trim(formData('pos_code')) . "',
55 domain_identifier='" . trim(formData('domain_identifier')) . "',
56 facility_npi='" . trim(formData('facility_npi')) . "',
57 attn='" . trim(formData('attn')) . "' ,
58 primary_business_entity='" . trim(formData('primary_business_entity')) . "' ,
59 tax_id_type='" . trim(formData('tax_id_type')) . "'
60 where id='" . trim(formData('fid')) . "'" );
64 <html>
65 <head>
66 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
67 <link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['webroot'] ?>/library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
68 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js"></script>
69 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.1.3.2.js"></script>
70 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/common.js"></script>
71 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
72 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery-ui.js"></script>
74 <script type="text/javascript">
77 $(document).ready(function(){
79 // fancy box
80 enable_modals();
82 // special size for
83 $(".addfac_modal").fancybox( {
84 'overlayOpacity' : 0.0,
85 'showCloseButton' : true,
86 'frameHeight' : 460,
87 'frameWidth' : 650
88 });
90 // special size for
91 $(".medium_modal").fancybox( {
92 'overlayOpacity' : 0.0,
93 'showCloseButton' : true,
94 'frameHeight' : 460,
95 'frameWidth' : 650
96 });
98 });
100 </script>
101 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
102 </head>
104 <body class="body_top">
106 <div>
107 <div>
108 <table><tr><td>
109 <b><?php xl('Facilities','e'); ?></b>&nbsp;</td><td>
110 <a href="facilities_add.php" class="iframe addfac_modal css_button"><span><?php xl('Add','e');?></span></a>
111 </td></tr>
112 </table>
113 </div>
114 <div class="tabContainer" style="width:550px;">
115 <div>
116 <table cellpadding="1" cellspacing="0" class="showborder">
117 <tr class="showborder_head" height="22">
118 <th style="border-style:1px solid #000" width="140px"><?php xl('Name','e'); ?></th>
119 <th style="border-style:1px solid #000" width="320px"><?php xl('Address','e'); ?></th>
120 <th style="border-style:1px solid #000"><?php xl('Phone','e'); ?></th>
121 </tr>
122 <?php
123 $fres = 0;
124 $fres = sqlStatement("select * from facility order by name");
125 if ($fres) {
126 $result2 = array();
127 for ($iter3 = 0;$frow = sqlFetchArray($fres);$iter3++)
128 $result2[$iter3] = $frow;
129 foreach($result2 as $iter3) {
130 $varstreet="";//these are assigned conditionally below,blank assignment is done so that old values doesn't get propagated to next level.
131 $varcity="";
132 $varstate="";
133 $varstreet=$iter3{street };
134 if ($iter3{street }!="")$varstreet=$iter3{street }.",";
135 if ($iter3{city}!="")$varcity=$iter3{city}.",";
136 if ($iter3{state}!="")$varstate=$iter3{state}.",";
138 <tr height="22">
139 <td valign="top" class="text"><b><a href="facility_admin.php?fid=<?php echo $iter3{id};?>" class="iframe medium_modal"><span><?php echo htmlspecialchars($iter3{name});?></span></a></b>&nbsp;</td>
140 <td valign="top" class="text"><?php echo htmlspecialchars($varstreet.$varcity.$varstate.$iter3{country_code}." ".$iter3{postal_code}); ?>&nbsp;</td>
141 <td><?php echo htmlspecialchars($iter3{phone});?>&nbsp;</td>
142 </tr>
143 <?php
146 if (count($result2)<=0)
148 <tr height="25">
149 <td colspan="3" style="text-align:center;font-weight:bold;"> <?php echo xl( "Currently there are no facilities." ); ?></td>
150 </tr>
151 <?php }
153 </table>
154 </div>
155 </div>
156 </div>
157 <script language="JavaScript">
158 <?php
159 if ($alertmsg = trim($alertmsg)) {
160 echo "alert('$alertmsg');\n";
163 </script>
165 </body>
166 </html>