2 error_reporting(E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
);
3 require('./roots.php');
4 require($root_path.'include/inc_environment_global.php');
6 * CARE2X Integrated Hospital Information System Deployment 2.2 - 2006-07-10
7 * GNU General Public License
8 * Copyright 2002,2003,2004,2005,2006 Elpidio Latorilla
11 * See the file "copy_notice.txt" for the licence notice
13 define('LANG_FILE','intramail.php');
14 $local_user='ck_intra_email_user';
15 require_once($root_path.'include/inc_front_chain_lang.php');
18 * check the info params for completeness
20 if(!isset($addr)) $addr='';
21 if(!isset($mode)) $mode='';
22 if(!isset($task)) $task='';
25 if(($mode=='saveadd')&&($addr=='')) { header('location:intra-email-addrbook.php'.URL_REDIRECT_APPEND
); exit;}
27 require_once($root_path.'include/inc_config_color.php'); // load color preferences
29 $thisfile=basename(__FILE__
);
30 $breakfile='intra-email.php'.URL_APPEND
.'&mode=listmail';
31 $dbtable='care_mail_private_users';
34 $modetypes=array('sendmail','listmail');
36 $sql="SELECT addr_book, lastcheck FROM $dbtable WHERE email='".$HTTP_COOKIE_VARS[$local_user.$sid]."'";
37 if($ergebnis=$db->Execute($sql))
39 if($rows=$ergebnis->RecordCount())
41 $content=$ergebnis->FetchRow();
45 // if new address save new address
48 $buf="n=$name&a=$alias&e=$addr@$dept\r\n";
49 // $content[addr_book]=trim($content[addr_book]);
50 if($content['addr_book']=="") $content['addr_book']=$buf;
51 else $content[addr_book
].="_".$buf;
52 $sql="UPDATE $dbtable SET addr_book='".$content['addr_book']."' , lastcheck='".$content['lastcheck']."'
53 WHERE email='".$HTTP_COOKIE_VARS[$local_user.$sid]."'";
55 $ok=$db->Execute($sql);
56 if($ok&&$db->CommitTrans())
58 header("location:intra-email-addrbook.php".URL_REDIRECT_APPEND
."&l2h=$l2h&folder=$folder&mode=$mode");
62 echo "$LDDbNoUpdate<br>$sql";
66 // if mode is delete entry
68 { //$content[addr_book]=strtolower($content[addr_book]);
69 $inb=explode("_",trim($content[addr_book
]));
70 for($i=0;$i<sizeof($inb);$i++
)
72 for($n=0;$n<$maxrow;$n++
)
75 if(!$
$delbuf) continue;
76 $delbuf2=trim(strtr($
$delbuf,"+"," "));
77 //echo "$delbuf2<br>$inb[$i]<br>";
78 //echo "vor comp $delbuf2<br>$inb[$i]<br>";
79 if(!strcmp($delbuf2,strtolower(trim($inb[$i]))))
81 //echo "nach comp $delbuf2<br>$inb[$i]<br>";
82 $trash=array_splice($inb,$i,1);//echo "trash <br>";
88 $content['addr_book']=implode('_',$inb);
89 $sql="UPDATE $dbtable SET addr_book='".trim($content['addr_book'])."', lastcheck='".$content['lastcheck']."'
90 WHERE email='".$HTTP_COOKIE_VARS[$local_user.$sid]."'";
92 $ok=$db->Execute($sql);
93 if($ok&&$db->CommitTrans()) {
94 header("location:intra-email-addrbook.php".URL_REDIRECT_APPEND
."&l2h=$l2h&folder=$folder&mode=$mode");
98 echo "$LDDbNoUpdate<br>$sql";
102 } // end of switch mode
105 }else { echo "$LDDbNoRead<br>$sql"; }
107 # Start Smarty templating here
112 # Note: it is advisable to load this after the inc_front_chain_lang.php so
113 # that the smarty script can use the user configured template theme
115 require_once($root_path.'gui/smarty_template/smarty_care.class.php');
116 $smarty = new smarty_care('common');
119 $smarty->assign('sToolbarTitle',"$LDIntraEmail - $LDAddrBook");
121 # href for help button
122 $smarty->assign('pbHelp',"javascript:gethelp('intramail.php','address','$mode','$folder')");
124 # href for close button
125 $smarty->assign('breakfile',$breakfile);
128 $smarty->assign('title',"$LDIntraEmail - $LDAddrBook");
130 # Set body onLoad javascript
131 if($task=="newadd") $smarty->assign('sOnLoadJs','onLoad="document.newform.name.focus();"');
133 # Collect extra javascript code
139 <script language
="javascript" >
144 document
.addrlist
.task
.value
="newadd";
145 document
.addrlist
.submit();
148 function chkAddress(d
)
152 alert("<?php echo $LDNoEmailAddress; ?>");
159 function chkDelete(d
,m
)
162 if(eval("d.del"+i+
".checked"))
163 if(confirm("<?php echo $LDConfirmDeleteAddr ?>")) return true;
165 for (i
=0;i
<m
;i++
) if(eval("d.del"+i+
".checked")) eval("d.del"+i+
".checked=false");
166 d
.sel_all
.checked
=false;
173 function selectAll(s
,m
)
175 if(s
.checked
) v
="true"; else v
="false";
177 for(i
=0;i
<m
;i++
) eval("d.del"+i+
".checked="+v
);
185 $sTemp = ob_get_contents();
188 $smarty->append('JavaScript',$sTemp);
190 # Start buffering page output
195 <b><a href="intra-email.php'.URL_APPEND
.'&mode=listmail">'.$LDInbox.'</a> |
196 <a href="intra-email.php'.URL_APPEND
.'&mode=compose">'.$LDNewEmail.'</a> | '.$LDAddrBook.' |
197 <a href="javascript:gethelp(\'intramail.php\',\'address\',\''.$mode.'\',\''.$folder.'\')">'.$LDHelp.'</a>|
198 <a href="intra-email-pass.php'.URL_APPEND
.'">'.$LDLogout.'</a></b>
200 <FONT color="#800000">'.$HTTP_COOKIE_VARS[$local_user.$sid].'</font>';
203 <?php
if($task=="newadd") : ?
>
205 <form name
=newform action
="<?php echo $thisfile ?>" method
=post onSubmit
="return chkAddress(this)">
206 <FONT face
="Verdana,Helvetica,Arial" size
=2 color
="#000080"><b
><?php
echo $LDSaveNewAddr ?
></b
></font
>
209 <td
> 
;<?php
echo "$LDName, $LDFirstName" ?
>:</td
>
210 <td colspan
=2><input type
="text" name
="name" size
=25 maxlength
=40 value
="<?php echo $name ?>">
214 <td
> 
;<?php
echo "$LDAlias/$LDShortName" ?
>:</td
>
215 <td colspan
=2><input type
="text" name
="alias" size
=25 maxlength
=40 value
="<?php echo $alias ?>" ></td
>
218 <td
> 
;<?php
echo $LDEmailAddr ?
>:<br
></td
>
219 <td
><input type
="text" name
="addr" size
=25 maxlength
=40 value
="<?php echo $addr ?>"></td
>
220 <td
><FONT face
="Verdana,Helvetica,Arial" size
=2 color
="#800000"><b
>@</b
>
221 <select name
="dept" size
=1>
223 <?php
require($root_path."include/inc_email_domains_options.php");
224 for ($j=0;$j<sizeof($email_domains);$j++
)
227 <option value="'.$email_domains[$j].'"';
228 if ($dept==$email_domains[$j]) echo "selected";
229 echo '>'.$email_domains[$j].'</option>';
236 <td
><input type
="submit" value
="<?php echo $LDSave ?>"></td
>
237 <td colspan
=2><input type
="reset" value
="<?php echo $LDJustReset ?>">
238 <input type
="button" value
="<?php echo $LDCancel ?>" onClick
="window.location.replace('intra-email-addrbook.php?sid=<?php echo "$sid&lang
=$lang&mode
=$mode&l2h
=$l2h&folder
=$folder" ?>')"></td
>
241 <input type
="hidden" name
="sid" value
="<?php echo $sid ?>">
242 <input type
="hidden" name
="lang" value
="<?php echo $lang ?>">
243 <input type
="hidden" name
="task" value
="saveadd">
244 <input type
="hidden" name
="l2h" value
="<?php echo $l2h ?>">
245 <input type
="hidden" name
="folder" value
="<?php echo $folder ?>">
246 <input type
="hidden" name
="mode" value
="<?php echo $mode ?>">
254 // ******************************** show address book***************************************
256 $arrlist=explode("_",strtolower($content[addr_book
]));
257 if($l2h) rsort($arrlist); else sort($arrlist);
259 $maxrow=sizeof($arrlist);
260 if(($maxrow==1)&&($arrlist[0]=="")) $maxrow=0;
263 <form name="addrlist" action="intra-email-addrbook.php" method="post" onSubmit="return chkDelete(this,'.sizeof($arrlist).')">
265 if ($maxrow>6) echo '
266 <input type="submit" value="'.$LDDelete.'"> <input type="button" value="'.$LDAddNewAddr.'" onClick="newAddr()">
268 echo ' <table border=0 cellspacing=0 width=100% cellpadding=0>
269 <tr ><td colspan=6 height=1><img src="'.$root_path.'gui/img/common/default/pixel.gif" border=0 height=3 width=1></td></tr>
270 <tr class="adm_list_titlebar">
272 <td> <input type="checkbox" name="sel_all" value="1" onClick="selectAll(this,'.$maxrow.')"><br>
275 if($l2h) echo '<a href="'.$thisfile.''.URL_APPEND
.'&l2h=0&mode='.$mode.'&folder='.$folder.'" title="'.$LDSortName.'"><img src="'.$root_path.'gui/img/common/default/arw_down.gif" '; else echo '<a href="'.$thisfile.''.URL_APPEND
.'&l2h=1&mode='.$mode.'&folder='.$folder.'" title="'.$LDSortName.'"><img src="'.$root_path.'gui/img/common/default/arw_up.gif" ';
277 width=12 height=20 border=0 align=absmiddle alt="'.$LDSortName.'"> '.$LDName.','.$LDFirstName.':</td>
278 <td> '.$LDAlias.'/'.$LDShortName.':
280 <td>'.$LDEmailAddr.':</font></a></td>
282 for($i=0;$i<sizeof($arrlist);$i++
)
284 parse_str(trim($arrlist[$i]),$minfo);
285 if(!isset($minfo['e'])) continue;
286 //$buf="intra-email-read.php?sid=$sid&ua=$ck_intra_email_user&s_stamp=$minfo[t]&read=$minfo[r]&from=$minfo[f]&subj=".strtr($minfo[s]," ","+")."&date=".strtr($minfo[d]," ","+")."&size=$minfo[z]&l2h=$l2h&folder=$folder";
287 $delbuf="n=$minfo[n]&a=$minfo[a]&e=$minfo[e]";
288 echo ' <tr bgcolor="#ffffff">
290 <td> <input type="checkbox" name="del'.$i.'" value="'.strtr($delbuf," ","+").'"><br>
292 <td> <a href="#" title="'.$LDMoreInfo.'">'.ucwords($minfo[n
]).'</a></td>
293 <td> '.$minfo[a
].'</td>
294 <td> '.$minfo[e
].'</td>
296 <tr ><td bgcolor="#66aace" colspan=6 height=1><img src="'.$root_path.'gui/img/common/default/pixel.gif" border=0 height=1 width=1></td></tr>';
299 <tr ><td colspan=6 height=1><img src="'.$root_path.'gui/img/common/default/pixel.gif" border=0 height=3 width=1></td></tr>
302 <input type="submit" value="'.$LDDelete.'"> ';
303 echo ' <input type="button" value="'.$LDAddNewAddr.'" onClick=newAddr()>
304 <br><input type="hidden" name="task" value="delete">
305 <input type="hidden" name="maxrow" value="'.$maxrow.'">
306 <input type="hidden" name="sid" value="'.$sid.'">
307 <input type="hidden" name="lang" value="'.$lang.'">
308 <input type="hidden" name="l2h" value="'.$l2h.'">
309 <input type="hidden" name="folder" value="'.$folder.'">
310 <input type="hidden" name="mode" value="'.$mode.'">
314 <font size=1><a href="intra-email.php'.URL_APPEND
.'&mode='.$mode.'&l2h='.$l2h.'&folder='.$folder.'">
315 <img '.createComIcon($root_path,'l_arrowgrnsm.gif','0','middle').'> '.$LDBack2.' ';
316 if($mode=="compose") echo $LDWriteEmail;
320 case "inbox": echo $LDInbox; break;
321 case "sent": echo $LDSent; break;
322 case "drafts": echo $LDDrafts; break;
323 case "trash": echo $LDRecycle; break;
328 $sTemp = ob_get_contents();
331 # Assign to main template object
332 $smarty->assign('sMainFrameBlockData',$sTemp);
337 $smarty->display('common/mainframe.tpl');