Exemplo n.º 1
0
function writeEmail($organ, $file, $state = SUBUNPUBLISHED, $attach = array())
{
    global $emailUN;
    global $emailPub;
    if ($subject == '') {
        if ($state == SUBUNPUBLISHED) {
            $to = $emailUN[$organ];
            $subject = 'Vorläufiges Protokoll: ' . $organ . ' ' . $file;
        } else {
            $to = $emailPub[$organ];
            $subject = 'Protokoll veröffentlicht: ' . $organ . ' ' . $file;
        }
    }
    // read email template
    $path = REPORTDIR . $organ . '.email';
    $text = "No email template provided for this organ";
    if (is_file($path)) {
        $file = fopen($path, "r") or die("File error");
        $text = fread($file, filesize($path));
        fclose($file);
    }
    return rlyWriteEmail($emailFrom[$organ], 'APVEL', $to, $subject, $text, $attach);
}
Exemplo n.º 2
0
                    file_put_contents(REPORTDIR . SUBPUBLISHED . $_GET['organ'] . ".resolutions.txt", $_GET['file'] . ": " . $str . "\n", FILE_APPEND);
                }
                // remove "[beschluss]" tags
                str_replace("[beschluss]", "", $text);
                str_replace("[/beschluss]", "", $text);
                file_put_contents($path, $text);
                //removes intern tags
                //move markdown file
                rename($path, REPORTDIR . SUBPUBLISHED . $_GET['organ'] . "/" . $_GET['file']);
                //write email
                $text = file_get_contents(REPORTDIR . $_GET['organ'] . ".email") . $text;
                $to = $emailPub[$_GET['organ']];
                $from = $emailFrom[_GET['organ']];
                $sub = "Protokoll veröffentlicht: " . $_GET['organ'] . ' ' . $_GET['file'];
                $attach = array(REPORTDIR . SUBPUBLISHED . $_GET['organ'] . "/" . $_GET['file'], REPORTDIR . SUBPUBLISHED . $_GET['organ'] . "/" . $_GET['file'] . ".pdf");
                rlyWriteEmail($from, "APVEL", $to, $sub, $text, $attach);
                header('Location: index.php');
                exit;
            } else {
                $tmp = tempnam("cache", $_GET['file']);
                $filename = explode("/", $tmp);
                $filename = $filename[count($filename) - 1];
                pandocToHTML($path, "cache/" . $filename . ".html");
            }
            $smarty->assign('tmp', $filename);
            $smarty->assign('text', $text);
            $smarty->assign('organ', $_GET['organ']);
            $smarty->assign('file', $_GET['file']);
        }
    }
}
Exemplo n.º 3
0
<?php

session_start();
require_once 'lib.php';
require_once 'defines.php';
if (isset($_GET['organ']) && isset($_GET['file'])) {
    if (checkOrgan($_GET['organ']) && checkReadPerms($_GET['organ']) && checkFilename($_GET['file'])) {
        $file = REPORTDIR . SUBUNPUBLISHED . $_GET['organ'] . "/" . $_GET['file'];
        pandocToPDF($file, $file . ".pdf");
        $text = file_get_contents(REPORTDIR . $_GET['organ'] . ".email");
        $text .= "\n Edit-Link: https://protokolle.asta.kit.edu/edit/" . $_GET['organ'] . "/" . $_GET['file'] . " \n";
        $text .= file_get_contents($file);
        echo rlyWriteEmail("*****@*****.**", "APVEL", $emailUN[$_GET['organ']], "Unveröffentlichtes Protokoll" . $_GET['file'] . " " . $_GET['organ'], $text, array($file . ".pdf", $file));
    }
}
Exemplo n.º 4
0
// include from permissions.config.php
$smarty->assign('this', 'index.php');
//post/get?
if (isset($_GET['organ']) && checkOrgan($_GET['organ'])) {
    if (isset($_GET['withdraw'])) {
        if (checkOrgan($_GET['organ']) && checkAdminPerms($_GET['organ']) && checkFilename($_GET['report'])) {
            $mdfile = $_GET['report'];
            $mdpath = REPORTDIR . SUBPUBLISHED . $_GET['organ'] . "/" . $mdfile;
            $htmlpath = $mdpath . ".html";
            $pdfpath = $mdpath . ".pdf";
            rename($mdpath, REPORTDIR . SUBUNPUBLISHED . $_GET['organ'] . "/" . $mdfile);
            unlink($htmlpath);
            unlink($pdfpath);
            //write Email:
            $sub = "Protokoll zurueckgezogen : " . $_GET["organ"] . $_GET['report'];
            rlyWriteEmail($emailFrom[$_GET['organ']], 'APVEL', $emailUN[$_GET['organ']], $sub, "Begruendung folgt gleich", array());
        }
    } else {
        //show unpublished reports?
        $smarty->assign("read", checkReadPerms($_GET['organ']));
        $smarty->assign("write", checkWritePerms($_GET['organ']));
        $smarty->assign("admin", checkAdminPerms($_GET['organ']));
        //show unpublished reports
        $folderPub = REPORTDIR . SUBPUBLISHED . $_GET['organ'] . '/';
        $folderUnPub = REPORTDIR . SUBUNPUBLISHED . $_GET['organ'] . '/';
        if (!is_dir($folderPub)) {
            die("Wrong folder structure: " . $folderPub);
        }
        if (!is_dir($folderUnPub)) {
            die("Wrong folder structure: " . $folderUnPub);
        }