- modules/fotolab updated imagej to current version & some cod fixes to make it work
[care2x.git] / Care2007 / modules / intranet_email / intra-email-delete.php
blob52c5d06cb1a3bc0e5b5287b5cd9061aaf986edfa
1 <?php
2 error_reporting(E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR);
3 require('./roots.php');
4 require($root_path.'include/inc_environment_global.php');
5 /**
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
9 * elpidio@care2x.org,
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 if(!isset($maxrow)||(isset($maxrow)&&empty($maxrow))||!isset($folder)||(isset($folder)&&empty($folder))) { header("location:intra-email.php".URL_REDIRECT_APPEN."&mode=listmail"); exit;}
19 if(isset($create)&&$create) {
20 $del0="t=$t&r=$r&f=$f&s=$s&d=$d&z=$z";
21 } else {
22 for($i=0;$i<$maxrow;$i++) {
23 $delbuf="del$i";
24 if(isset($$delbuf)&&$$delbuf){ $delok=1; break;}
27 if(!isset($delok)||!$delok) {
28 header("location:intra-email.php".URL_REDIRECT_APPEND."&mode=listmail"); exit;}
31 //$db->debug=1;
33 require_once($root_path.'include/inc_config_color.php'); // load color preferences
34 //echo $del0;
35 $thisfile=basename(__FILE__);
36 //foreach($arg as $v) echo "$v<br>"; //init db parameters
37 $dbtable='care_mail_private_users';
39 $linecount=0;
40 $modetypes=array('sendmail','listmail');
42 $sql="SELECT $folder, lastcheck FROM $dbtable WHERE email='".$HTTP_COOKIE_VARS[$local_user.$sid]."'";
43 if($ergebnis=$db->Execute($sql))
45 if($ergebnis->RecordCount())
47 $result=$ergebnis->FetchRow();
48 $inb=explode("_",trim($result[$folder]));
49 for($i=0;$i<sizeof($inb);$i++)
51 for($n=0;$n<$maxrow;$n++)
53 $delbuf="del$n";
54 if(!isset($$delbuf)||!$$delbuf) continue;
55 $delbuf2=trim(strtr($$delbuf,"+"," "));
56 //echo "$delbuf2<br>$inb[$i]<br>";
57 if(eregi($delbuf2,trim($inb[$i])))
59 $trash=array_splice($inb,$i,1);
60 $i--;
61 break;
65 $result[$folder]=implode("_",$inb);
66 $sql="UPDATE $dbtable SET $folder='".$result[$folder]."', lastcheck='".$result['lastcheck']."'
67 WHERE email='".$HTTP_COOKIE_VARS[$local_user.$sid]."'";
69 $db->BeginTrans();
70 $ok=$db->Execute($sql);
71 if($ok&&$db->CommitTrans()) {
73 // update the recyle folder
74 if($folder!='trash')
76 $sql="SELECT trash, lastcheck FROM $dbtable WHERE email='".$HTTP_COOKIE_VARS[$local_user.$sid]."'";
77 if($ergebnis=$db->Execute($sql))
79 if($ergebnis->RecordCount())
81 $result=$ergebnis->FetchRow();
82 //echo "$maxrow ";
83 for($n=0;$n<$maxrow;$n++)
85 $delbuf="del$n";
86 if(!isset($$delbuf)||!$$delbuf) continue;
87 $delbuf2=trim(strtr($$delbuf,"+"," "));
88 //echo $delbuf2."<br>";
89 if($result['trash']=="") $result['trash']=$delbuf2."\r\n";
90 else $result['trash'].="_".$delbuf2."\r\n";
92 $sql="UPDATE $dbtable SET trash='".$result['trash']."', lastcheck='".$result['lastcheck']."'
93 WHERE email='".$HTTP_COOKIE_VARS[$local_user.$sid]."'";
94 $db->BeginTrans();
95 $ok=$db->Execute($sql);
96 if($ok) {
97 $db->CommitTrans();
98 } else {
99 $db->RollbackTrans();
100 echo "$LDDbNoUpdate<br>$sql";
103 //echo $sql;
104 } else { echo "$LDDbNoRead<br>$sql"; }
106 header("location:intra-email.php?sid=$sid&lang=$lang&mode=listmail&l2h=$l2h&folder=$folder");
107 }else {
108 $db->RollbackTrans();
109 echo "$LDDbNoUpdate<br>$sql";
112 }else { echo "$LDDbNoRead<br>$sql"; }