diff --git a/application/helpers/hlp_sancho_helper.php b/application/helpers/hlp_sancho_helper.php index c788f1bbf..f063365ec 100644 --- a/application/helpers/hlp_sancho_helper.php +++ b/application/helpers/hlp_sancho_helper.php @@ -66,7 +66,7 @@ function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerIm $body = _parseMailContent('Sancho_Mail_Template', $layout); // Send mail - $ci->maillib->send('sancho@'. DOMAIN, $to, $subject, $body); + $ci->maillib->send('sancho@'. DOMAIN, $to, $subject, $body, $alias = '', $cc = null, $bcc = null, $altMessage = '', $bulk = true, $autogenerated = true); } /** diff --git a/application/libraries/MailLib.php b/application/libraries/MailLib.php index 0871273b5..6d0a48f73 100644 --- a/application/libraries/MailLib.php +++ b/application/libraries/MailLib.php @@ -19,7 +19,7 @@ class MailLib * Class constructor */ public function __construct() - { + { // Set the counter to 0 $this->sended = 0; @@ -46,7 +46,7 @@ class MailLib /** * Sends a single email */ - public function send($from, $to, $subject, $message, $alias = '', $cc = null, $bcc = null, $altMessage = '') + public function send($from, $to, $subject, $message, $alias = '', $cc = null, $bcc = null, $altMessage = '', $bulk = false, $autogenerated = false) { // If from is not specified then use the standard one if (is_null($from) || $from == '') @@ -90,6 +90,11 @@ class MailLib $this->ci->email->message($message); if (!isEmptyString($altMessage)) $this->ci->email->set_alt_message($altMessage); + if($bulk) + $this->ci->email->set_header('Precedence', 'bulk'); + if($autogenerated) + $this->ci->email->set_header('Auto-Submitted', 'auto-generated'); + // Avoid printing on standard output ugly error messages $result = @$this->ci->email->send(); diff --git a/cms/admin_dms.php b/cms/admin_dms.php index 11d4e3086..6dce630d9 100644 --- a/cms/admin_dms.php +++ b/cms/admin_dms.php @@ -127,7 +127,7 @@ if (isset($_REQUEST['save'])) $dms->gruppe_kurzbz = $_POST['gruppe_kurzbz']; $dms->insertamum = date('Y-m-d H:i:s'); $dms->insertvon = $user; - + if (! $dms->saveGruppeKategorie()) echo '' . $dms->errormsg . ''; else @@ -145,7 +145,7 @@ if (isset($_REQUEST['save'])) { // wenn keine auswahl getroffen wurde $kategorie_auswahl = (($_POST['kategorie_parent'] == 'auswahl') ? null : $_POST['kategorie_parent']); - + if ($kategorieSave->loadKategorie($_POST['kategorie_kurzbz'])) { // Update @@ -184,7 +184,7 @@ if (isset($_REQUEST['save'])) // Löscht eine Kategorie if (isset($_REQUEST['delete'])) { - + if ($method == 'gruppe') { $dms = new dms(); @@ -205,7 +205,7 @@ if (isset($_REQUEST['delete'])) } else echo "keine Kategorie übergeben"; - + $kategorie_kurzbz = ''; } } @@ -270,7 +270,7 @@ switch ($method) case 'gruppe': print_rights($kategorie_kurzbz); break; - + default: drawKategorie($kategorie_kurzbz); break; @@ -287,7 +287,8 @@ function drawKategorie($kategorie_kurzbz) $kategorie_bezeichnung = ''; $disabled = ''; $kategorie_berechtigung = ''; - + $kategorie_oe_kurzbz = ''; + if ($kategorie->loadKategorie($kategorie_kurzbz)) { // Formular zum Editieren bestehender Kategorien @@ -297,7 +298,7 @@ function drawKategorie($kategorie_kurzbz) $kategorie_berechtigung = $kategorie->berechtigung_kurzbz; $kategorie_oe_kurzbz = $kategorie->kategorie_oe_kurzbz; } - + $allKategorien = new dms(); $allKategorien->getAllKategories(); $berechtigungen = new berechtigung(); @@ -305,7 +306,7 @@ function drawKategorie($kategorie_kurzbz) $organisationseinheiten = new organisationseinheit(); $organisationseinheiten->getAll(true, null, 'organisationseinheittyp_kurzbz, bezeichnung'); $oe_typ = ''; - + // var_dump($allKategorien->result); echo '
@@ -341,13 +342,13 @@ function drawKategorie($kategorie_kurzbz) { if ($oe_typ!='') echo ''; - + echo ''; } $selected = ''; if ($oe->oe_kurzbz == $kategorie_oe_kurzbz) $selected = 'selected'; - + echo ''; $oe_typ = $oe->organisationseinheittyp_kurzbz; } @@ -362,7 +363,7 @@ function drawKategorie($kategorie_kurzbz) $selected = ''; if ($recht->berechtigung_kurzbz == $kategorie_berechtigung) $selected = 'selected'; - + echo ''; } echo ' @@ -427,17 +428,17 @@ function print_rights($kategorie_kurzbz) } else echo 'Diese Seite darf von allen angezeigt werden!

'; - + $gruppe = new gruppe(); $gruppe->getgruppe(null, null, null, null, true); - + // Sortieren der Gruppen nach kurzbz - function sortGruppen($a, $b) - { - return strcasecmp($a->gruppe_kurzbz, $b->gruppe_kurzbz); + function sortGruppen($a, $b) + { + return strcasecmp($a->gruppe_kurzbz, $b->gruppe_kurzbz); } - usort($gruppe->result, "sortGruppen"); - + usort($gruppe->result, "sortGruppen"); + // function sortDocuments($a, $b) // { // $c = $a->anzahl_akten_formal_geprueft - $b->anzahl_akten_formal_geprueft; @@ -449,7 +450,7 @@ function print_rights($kategorie_kurzbz) // } // if ($dokumente_abzugeben) // usort($dokumente_abzugeben, "sortDocuments"); - + echo ''; echo 'Gruppe
diff --git a/cms/dms.php b/cms/dms.php index ad7a102d6..6548dc1e3 100644 --- a/cms/dms.php +++ b/cms/dms.php @@ -43,37 +43,37 @@ else $akte_id =''; //if(!isset($_GET['version'])) -// die('Version muss uebergeben werden'); - +// die('Version muss uebergeben werden'); + $id = $_GET['id']; -$version = isset($_GET['version'])?$_GET['version']:null; +$version = isset($_GET['version'])?$_GET['version']:null; if(!is_numeric($id)) die('ID ist ungueltig'); - + if($version!='' && !is_numeric($version)) - die('Version ist ungueltig'); - + die('Version ist ungueltig'); + $doc = new dms(); if(!$doc->load($id,$version)) die('Dieses Dokument existiert nicht mehr'); if($doc->isLocked($id)) { - //Wenn person_id aus Session und akte_id uebergeben wurde - //und person_id Besitzer des Dokuments ist (person_id aus tbl_akte) + //Wenn person_id aus Session und akte_id uebergeben wurde + //und person_id Besitzer des Dokuments ist (person_id aus tbl_akte) //und das Dokument in der Onlinebewerbung hochgeladen werden kann //darf das Dokument heruntergeladen werden if($person_id!='' && $akte_id!='') - { + { $akte = new akte(); $akte->load($akte_id); $akte_person = $akte->person_id; $akte_dokument_kurzbz = $akte->dokument_kurzbz; - + $dokumente_person = new dokument(); $dokumente_person->getAllDokumenteForPerson($person_id, true); - + $dokumente_arr = array(); foreach ($dokumente_person->result AS $row) $dokumente_arr[] .= $row->dokument_kurzbz; @@ -90,11 +90,23 @@ if($doc->isLocked($id)) { //Dokument erfordert Authentifizierung $user = get_uid(); + + $rechte = new benutzerberechtigung(); + $rechte->getBerechtigungen($user); + if(!$doc->isBerechtigt($id, $user)) { + // Wenn eine Berechtigung an der Kategorie haengt + // dann darf nur mit diesem Recht darauf zugegriffen werden + $kategorie = new dms(); + $kategorie->loadKategorie($doc->kategorie_kurzbz); + if($kategorie->berechtigung_kurzbz!='') + { + if(!$rechte->isBerechtigt($kategorie->berechtigung_kurzbz)) + die('Sie haben keinen Zugriff auf dieses Dokument'); + } + //Globales DMS recht pruefen - $rechte = new benutzerberechtigung(); - $rechte->getBerechtigungen($user); if(!$rechte->isBerechtigt('basis/dms')) die('Sie haben keinen Zugriff auf dieses Dokument'); } @@ -111,12 +123,12 @@ if(file_exists($filename)) { if($doc->mimetype=='') $doc->mimetype='application/octetstream'; - + header('Content-type: '.$doc->mimetype); header('Content-Disposition: inline; filename="'.$doc->name.'"'); header('Content-Length: ' .filesize($filename)); - - while (!feof($handle)) + + while (!feof($handle)) { echo fread($handle, 8192); } @@ -127,4 +139,4 @@ if(file_exists($filename)) } else echo 'Die Datei existiert nicht'; -?> \ No newline at end of file +?> diff --git a/cms/menu/menu_addon_urlaub.inc.php b/cms/menu/menu_addon_urlaub.inc.php index bfcbd83b4..3321e3f47 100644 --- a/cms/menu/menu_addon_urlaub.inc.php +++ b/cms/menu/menu_addon_urlaub.inc.php @@ -19,7 +19,7 @@ */ /** * Menu Addon fuer Urlaube - * + * * Zeigt eine Liste der untergebenen Mitarbeiter mit deren Urlaube */ require_once(dirname(__FILE__).'/menu_addon.class.php'); @@ -33,25 +33,25 @@ class menu_addon_urlaub extends menu_addon public function __construct() { parent::__construct(); - + $sprache = getSprache(); $user = get_uid(); - + $p = new phrasen($sprache); - + //Untergebene holen $mitarbeiter = new mitarbeiter(); $mitarbeiter->getUntergebene($user); $untergebene = ''; - + foreach ($mitarbeiter->untergebene as $u_uid) { if($untergebene!='') $untergebene.=','; - + $untergebene.="'".addslashes($u_uid)."'"; } - + $rechte = new benutzerberechtigung(); $rechte->getBerechtigungen($user); if($rechte->isBerechtigt('mitarbeiter/urlaube', null, 'suid')) @@ -65,14 +65,14 @@ class menu_addon_urlaub extends menu_addon $untergebene.="'".addslashes($row->uid)."'"; } } - + if($untergebene!='') { - $qry = "SELECT * FROM campus.vw_mitarbeiter WHERE uid in($untergebene) AND aktiv ORDER BY nachname, vorname"; + $qry = "SELECT * FROM campus.vw_mitarbeiter WHERE uid in($untergebene) AND aktiv AND fixangestellt ORDER BY nachname, vorname"; $this->linkitem['link']='private/profile/urlaubsfreigabe.php'; $this->linkitem['target']='content'; - + if($result = $this->db_query($qry)) { $this->items[] = array('title'=>$p->t('menu/urlaubAlle'), @@ -80,31 +80,31 @@ class menu_addon_urlaub extends menu_addon 'link'=>'private/profile/urlaubsfreigabe.php', 'name'=>$p->t('menu/urlaubAlle') ); - + while($row = $this->db_fetch_object($result)) { - + $name = $row->nachname.' '.$row->vorname.' '.$row->titelpre.' '.$row->titelpost; $title = $row->nachname.' '.$row->vorname.' '.$row->titelpre.' '.$row->titelpost; - + if($row->fixangestellt=='f') $name = ''.$name.''; - + $this->items[] = array('title'=>$title, 'target'=>'content', 'link'=>'private/profile/urlaubsfreigabe.php?uid='.$row->uid, 'name'=>$name ); - + } } } else $this->link=false; - + $this->output(); } } new menu_addon_urlaub(); -?> \ No newline at end of file +?> diff --git a/content/notizdokdownload.php b/content/notizdokdownload.php index 90fde00d0..227149a0d 100644 --- a/content/notizdokdownload.php +++ b/content/notizdokdownload.php @@ -22,9 +22,10 @@ * oder im Filesystem, in diesem Fall ist die Akte mit einer DMS ID verknuepft in welcher der Dateiname steht. */ require_once('../config/vilesci.config.inc.php'); -require_once('../include/dms.class.php'); +require_once('../include/dms.class.php'); require_once('../include/benutzerberechtigung.class.php'); require_once('../include/functions.inc.php'); +require_once('../include/notiz.class.php'); $user = get_uid(); $rechte = new benutzerberechtigung(); @@ -34,11 +35,15 @@ if(!$rechte->isBerechtigt('admin') && !$rechte->isBerechtigt('assistenz') && !$r if(isset($_GET['id']) && is_numeric($_GET['id'])) { - $dms = new dms(); - if(!$dms->load($_GET['id'])) - die('Kein Dokument vorhanden'); + $notiz = new notiz(); + if(!$notiz->isNotizDokument($_GET['id'])) + die('Dokument wurde nicht gefunden oder haengt nicht an einer Notiz'); - $filename=DMS_PATH.$dms->filename; + $dms = new dms(); + if(!$dms->load($_GET['id'])) + die('Kein Dokument vorhanden'); + + $filename=DMS_PATH.$dms->filename; if(!isset($_GET['notimeupdate'])) $dms->touch($dms->dms_id, $dms->version); @@ -54,7 +59,7 @@ if(isset($_GET['id']) && is_numeric($_GET['id'])) header('Content-Disposition: inline; filename="'.$dms->name.'"'); header('Content-Length: ' .filesize($filename)); - while (!feof($handle)) + while (!feof($handle)) { echo fread($handle, 8192); } @@ -71,4 +76,4 @@ else echo "Ungueltige DMS-ID"; } -?> \ No newline at end of file +?> diff --git a/include/dms.class.php b/include/dms.class.php index f16580c85..98cfbdd9a 100644 --- a/include/dms.class.php +++ b/include/dms.class.php @@ -1179,9 +1179,7 @@ class dms extends basis_db */ function isLocked($dms_id) { - $qry = "SELECT 1 FROM - ( - WITH RECURSIVE kategorien(parent_kategorie_kurzbz) as + $qry = "WITH RECURSIVE kategorien(parent_kategorie_kurzbz) as ( SELECT parent_kategorie_kurzbz FROM campus.tbl_dms_kategorie WHERE kategorie_kurzbz=(SELECT kategorie_kurzbz FROM campus.tbl_dms WHERE dms_id=".$this->db_add_param($dms_id, FHC_INTEGER).") @@ -1192,12 +1190,20 @@ class dms extends basis_db WHERE k.kategorie_kurzbz=kategorien.parent_kategorie_kurzbz ) - SELECT parent_kategorie_kurzbz - FROM kategorien - ) a - JOIN campus.tbl_dms_kategorie_gruppe ON(a.parent_kategorie_kurzbz=kategorie_kurzbz) + SELECT + 1 + FROM + kategorien + JOIN campus.tbl_dms_kategorie_gruppe ON(kategorien.parent_kategorie_kurzbz=kategorie_kurzbz) UNION SELECT 1 FROM fue.tbl_projekt_dokument WHERE dms_id=".$this->db_add_param($dms_id, FHC_INTEGER)." + UNION + SELECT + 1 + FROM + kategorien + JOIN campus.tbl_dms_kategorie ON(kategorien.parent_kategorie_kurzbz=kategorie_kurzbz) + WHERE berechtigung_kurzbz is not null ;"; if($result = $this->db_query($qry)) diff --git a/include/notiz.class.php b/include/notiz.class.php index 08ba10e41..63f15638d 100644 --- a/include/notiz.class.php +++ b/include/notiz.class.php @@ -24,7 +24,7 @@ class notiz extends basis_db { public $new; public $result=array(); - public $dokumente=array(); + public $dokumente=array(); //Tabellenspalten public $notiz_id; @@ -40,15 +40,15 @@ class notiz extends basis_db public $updateamum; public $updatevon; - public $projekt_kurzbz; - public $projektphase_id; - public $projekttask_id; - public $uid; - public $person_id; - public $prestudent_id; - public $bestellung_id; - public $lehreinheit_id; - public $anrechnung_id; + public $projekt_kurzbz; + public $projektphase_id; + public $projekttask_id; + public $uid; + public $person_id; + public $prestudent_id; + public $bestellung_id; + public $lehreinheit_id; + public $anrechnung_id; /** * Konstruktor @@ -93,7 +93,7 @@ class notiz extends basis_db $this->insertvon=$row->insertvon; $this->updateamum=$row->updateamum; $this->updatevon=$row->updatevon; - $this->getDokumente($row->notiz_id); + $this->getDokumente($row->notiz_id); return true; } @@ -123,17 +123,17 @@ class notiz extends basis_db return false; } - // Dokumente der Notiz löschen - $this->getDokumente($notiz_id); - if(!empty($this->dokumente)) - { - $dms = new dms(); + // Dokumente der Notiz löschen + $this->getDokumente($notiz_id); + if(!empty($this->dokumente)) + { + $dms = new dms(); - foreach($this->dokumente as $dms_id) - { - $dms->deleteDms($dms_id); - } - } + foreach($this->dokumente as $dms_id) + { + $dms->deleteDms($dms_id); + } + } $qry = "Delete FROM public.tbl_notiz WHERE notiz_id=".$this->db_add_param($notiz_id, FHC_INTEGER); @@ -267,14 +267,14 @@ class notiz extends basis_db } } - /** - * Speichert ein Dokument zur Notiz - * @param int $dms_id - * @return boolean - */ - public function saveDokument($dms_id) - { - $qry = "INSERT INTO public.tbl_notiz_dokument(notiz_id, dms_id) VALUES(". + /** + * Speichert ein Dokument zur Notiz + * @param int $dms_id + * @return boolean + */ + public function saveDokument($dms_id) + { + $qry = "INSERT INTO public.tbl_notiz_dokument(notiz_id, dms_id) VALUES(". $this->db_add_param($this->notiz_id, FHC_INTEGER).','. $this->db_add_param($dms_id, FHC_INTEGER).');'; @@ -287,7 +287,7 @@ class notiz extends basis_db $this->errormsg = 'Fehler beim Speichern der Daten'; return false; } - } + } /** * @@ -377,7 +377,7 @@ class notiz extends basis_db $obj->insertvon=$row->insertvon; $obj->updateamum=$row->updateamum; $obj->updatevon=$row->updatevon; - $obj->getDokumente($row->notiz_id); + $obj->getDokumente($row->notiz_id); $this->result[] = $obj; } @@ -404,9 +404,9 @@ class notiz extends basis_db public.tbl_notiz LEFT JOIN public.tbl_notizzuordnung USING(notiz_id) WHERE person_id = ' . $this->db_add_param($person_id, FHC_INTEGER) . - ' AND (insertvon = ' . $this->db_add_param('online') .' OR insertvon = ' . $this->db_add_param('online_notiz').') + ' AND (insertvon = ' . $this->db_add_param('online') .' OR insertvon = ' . $this->db_add_param('online_notiz').') - ORDER BY notiz_id'; + ORDER BY notiz_id'; if($result = $this->db_query($qry)) { @@ -444,7 +444,7 @@ class notiz extends basis_db * (Name und Adresse der besuchten Schule) in eine Notiz mit * insertvon = online_ausbildung gespeichert. * Wird auf UDF umgebaut! - * + * * Laedt die Notizen zur Ausbilund vom Bewerbungstool * @param $person_id int * @return boolean @@ -457,8 +457,8 @@ class notiz extends basis_db public.tbl_notiz LEFT JOIN public.tbl_notizzuordnung USING(notiz_id) WHERE person_id = ' . $this->db_add_param($person_id, FHC_INTEGER) . - ' AND insertvon = ' . $this->db_add_param('online_ausbildung') . - ' ORDER BY notiz_id'; + ' AND insertvon = ' . $this->db_add_param('online_ausbildung') . + ' ORDER BY notiz_id'; if($result = $this->db_query($qry)) { @@ -564,13 +564,13 @@ class notiz extends basis_db } } - /** - * Laedt die Dokumente der Notiz - * @return boolean - */ - public function getDokumente($notiz_id) - { - $qry = "SELECT dms_id FROM public.tbl_notiz_dokument WHERE notiz_id=".$this->db_add_param($notiz_id, FHC_INTEGER); + /** + * Laedt die Dokumente der Notiz + * @return boolean + */ + public function getDokumente($notiz_id) + { + $qry = "SELECT dms_id FROM public.tbl_notiz_dokument WHERE notiz_id=".$this->db_add_param($notiz_id, FHC_INTEGER); if($this->db_query($qry)) { @@ -579,12 +579,35 @@ class notiz extends basis_db $this->dokumente[] = $row->dms_id; } - return true; + return true; } else { $this->errormsg = 'Fehler beim Laden der Daten'; return false; } - } + } + + /** + * Prueft ob das Dokument an einer Notiz haengt + * @param $dms_id DMS id des Dokuments. + * @return boolean true wenn das Dokument an einer Notiz hängt, sonst false. + */ + public function isNotizDokument($dms_id) + { + $qry = "SELECT * FROM public.tbl_notiz_dokument WHERE dms_id=".$this->db_add_param($dms_id, FHC_INTEGER); + + if($result = $this->db_query($qry)) + { + if($this->db_num_rows($result)>0) + return true; + else + return false; + } + else + { + $this->errormsg = 'Fehler beim Laden der Daten'; + return false; + } + } }