Example #1
0
 function set_courses_units_boxes()
 {
     $room_path = $this->request['attribute'];
     logging::write_log(LOG_MESSAGES, $room_path);
     $room = steam_factory::path_to_object($GLOBALS["STEAM"]->get_id(), $room_path, 0);
     $room->set_attribute("box_sort_order", serialize($this->request['boxes']));
 }
function paul_sync_log($message, $level = -1, $append = FALSE)
{
    if (defined("PAUL_SYNC_LOGLEVEL") && $level <= PAUL_SYNC_LOGLEVEL) {
        if ($append) {
            logging::append_log(LOG_PAULSYNC, $message);
            try {
                if (defined("LOG_PAULSYNC_LAST")) {
                    logging::append_log(LOG_PAULSYNC_LAST, $message);
                }
            } catch (Exception $ex) {
                /*ignore*/
            }
        } else {
            logging::write_log(LOG_PAULSYNC, $message);
            try {
                if (defined("LOG_PAULSYNC_LAST")) {
                    logging::write_log(LOG_PAULSYNC_LAST, $message);
                }
            } catch (Exception $ex) {
                /*ignore*/
            }
        }
    }
}
Example #3
0
 public function send404Error()
 {
     logging::write_log(LOG_404, date("d.m.Y H:i", time()) . " " . "HTTP-" . $_SERVER['REQUEST_METHOD'] . ': ' . $_SERVER['REQUEST_URI']);
     header("Location: " . URL_404);
     die;
 }
Example #4
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $group_id = $this->params[0];
     $user = \lms_steam::get_current_user();
     try {
         $steam_group = !empty($group_id) ? \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $group_id) : FALSE;
     } catch (Exception $ex) {
         include "bad_link.php";
         exit;
     }
     $group_is_private = FALSE;
     if ($steam_group && is_object($steam_group)) {
         switch ((string) $steam_group->get_attribute("OBJ_TYPE")) {
             case "course":
                 $group = new koala_group_course($steam_group);
                 // TODO: Passt der backlink?
                 $backlink = PATH_URL . SEMESTER_URL . "/" . $group->get_semester()->get_name() . "/" . h($group->get_name()) . "/";
                 break;
             default:
                 $group = new \koala_group_default($steam_group);
                 // TODO: Passt der backlink?
                 $backlink = PATH_URL . "groups/" . $group->get_id() . "/";
                 // Determine if group is public or private
                 $parent = $group->get_parent_group();
                 if ($parent->get_id() == STEAM_PRIVATE_GROUP) {
                     $group_is_private = TRUE;
                 }
                 break;
         }
     }
     if ($group_is_private) {
         if (!$steam_group->is_member($user) && !\lms_steam::is_koala_admin($user)) {
             throw new Exception(gettext("You have no rights to access this group"), E_USER_RIGHTS);
         }
     }
     if (!$steam_group->check_access_write($user)) {
         throw new Exception(str_replace("%USER", $user->get_login(), sr_replace("%GROUP", $group->get_id(), gettext("Access denied: User %USER has no right to delete the group %GROUP"))), E_USER_RIGHTS);
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = $_POST["values"];
         $env = $steam_group->get_environment();
         // TODO: Passt der link?
         $upper_link = PATH_URL . "groups/" . (is_object($env) ? "?cat=" . $env->get_id() : "");
         $group_name = $group->get_display_name();
         $members = $group->get_members();
         $inventory = $group->get_workroom()->get_inventory_raw();
         $deleted = TRUE;
         foreach ($inventory as $object) {
             if (!$object instanceof \steam_user) {
                 try {
                     \lms_steam::delete($object);
                 } catch (Exception $ex3) {
                     \logging::write_log(LOG_DEBUGLOG, "groups_delete:error deleting object from group workroom\t" . $login . " \t" . $group->get_display_name() . " \t" . $steam_group->get_id() . " \t" . $object->get_id());
                 }
             }
         }
         if ($steam_group->delete()) {
             $user->get_attributes(array(OBJ_NAME, USER_FIRSTNAME, USER_FULLNAME));
             foreach ($members as $member) {
                 $cache = get_cache_function($member->get_name());
                 $cache->drop("lms_steam::user_get_groups", $member->get_name(), TRUE);
                 $cache->drop("lms_steam::user_get_groups", $member->get_name(), FALSE);
                 $cache->drop("lms_steam::user_get_profile", $member->get_name());
                 $cache->drop("lms_portal::get_menu_html", $member->get_name(), TRUE);
             }
             $cache = get_cache_function($steam_group->get_id());
             $cache->drop("lms_steam::group_get_members", $steam_group->get_id());
             foreach ($members as $member) {
                 \lms_steam::mail($member, $user, PLATFORM_NAME . ": " . str_replace("%NAME", h($group_name), gettext("Group %NAME has been deleted.")), str_replace("%USER", $user->get_name() . " (" . $user->get_attribute(USER_FIRSTNAME) . " " . $user->get_attribute(USER_FULLNAME) . ")", str_replace("%NAME", h($group_name), gettext("The group '%NAME' has been deleted from he koaLA System by %USER."))) . "\n\n-- \n" . str_replace("%NAME", h($group_name), gettext("This system generated notification message was sent to you as a former member of the deleted group \"%NAME\"")));
             }
             $_SESSION["confirmation"] = str_replace("%NAME", h($group_name), gettext("The group '%NAME' has been deleted. A notification has been sent to former members."));
             header("Location: " . $upper_link);
             exit;
         } else {
             throw new Exception("Deletion of group failed");
         }
     }
     $content = \Group::getInstance()->loadTemplate("group_delete.template.html");
     $content->setVariable("FORM_ACTION", "");
     $content->setVariable("LABEL_ARE_YOU_SURE", gettext("Are you sure?"));
     $content->setVariable("INFO_DELETE_GROUP", str_replace("%GROUP_NAME", h($group->get_name()), gettext("You are going to delete '%GROUP_NAME'.")) . "<br />" . gettext("All data of this group will be removed from the system including weblogs, wikis, forums and documents. All members of this group will be notified about the deletion automatically.") . "<br /><br /><strong>" . gettext("The deletion process may take several minutes.")) . "</strong>";
     $content->setVariable("LABEL_DELETE_IT", gettext("Yes, delete this group"));
     $content->setVariable("DELETE_BACK_LINK", $_SERVER["HTTP_REFERER"]);
     $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
     $content->setVariable("LABEL_RETURN", gettext("back"));
     $frameResponseObject->setTitle("Group");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Example #5
0
     } else {
         $problems = gettext("Could not upload document.") . " ";
         $hints = str_replace(array("%SIZE", "%TIME"), array(readable_filesize($max_file_size), (string) ini_get('max_execution_time')), gettext("Maybe your document exceeded the allowed file size (max. %SIZE) or the upload might have taken too long (max. %TIME seconds).")) . " ";
     }
 }
 if (empty($problems)) {
     $content = file_get_contents($_FILES["material"]["tmp_name"]);
     /*
     								ob_start();
     								readfile( $_FILES["material"]["tmp_name"] );
     								$content = ob_get_contents();
     								ob_end_clean();
     */
     if (defined("LOG_DEBUGLOG")) {
         $time1 = microtime(TRUE);
         logging::write_log(LOG_DEBUGLOG, "upload" . " \t" . $GLOBALS["STEAM"]->get_login_user_name() . " \t" . $_FILES["material"]["name"] . " \t" . filesize($_FILES["material"]["tmp_name"]) . " Bytes \t... ");
     }
     $filename = str_replace(array("\\", "'"), array("", ""), $_FILES["material"]["name"]);
     $new_material = steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $filename, $content, $_FILES["material"]["type"], FALSE);
     if (defined("LOG_DEBUGLOG")) {
         logging::append_log(LOG_DEBUGLOG, " \t" . round((microtime(TRUE) - $time1) * 1000) . " ms");
     }
     //  Disabled for Testing issues
     // upload($new_material->get_content_id(), $content);
     if (isset($values["dsc"])) {
         $new_material->set_attribute("OBJ_DESC", $values["dsc"]);
     }
     $new_material->move($env);
     $_SESSION["confirmation"] = str_replace("%DOCUMENT", h($filename), gettext("'%DOCUMENT' has been uploaded."));
     header("Location: " . $backlink);
     exit;
Example #6
0
 function get_document_attributes($id)
 {
     $mysql_data = array();
     $data = array();
     $rs = "";
     $query = "select * from ob_data where (ob_attr='DOC_MIME_TYPE' or ob_attr='OBJ_NAME' or ob_attr='DOC_LAST_MODIFIED' or ob_attr='OBJ_CREATION_TIME') and ob_id = " . $id;
     $result = mysql_query($query);
     if ($result) {
         while ($row = mysql_fetch_row($result)) {
             // store key value pairs in temp array
             //print("row[2]=" . $row[2] . " row[3]=" . $row[3]);
             $mysql_data[$row[2]] = str_replace('"', '', $row[3]);
         }
     } else {
         if (defined("LOG_DEBUGLOG")) {
             $time1 = microtime(TRUE);
             logging::write_log(LOG_DEBUGLOG, "download_handling::get_document_attributes\t" . $id . " \tresult is null fetching the needed attribute values");
         }
     }
     $mime = "application/x-unknown-content-type";
     if (isset($mysql_data[DOC_MIME_TYPE]) && $mysql_data[DOC_MIME_TYPE] != "") {
         $mime = $mysql_data[DOC_MIME_TYPE];
     }
     $data["mimetype"] = $mime;
     $lm = $mysql_data[OBJ_CREATION_TIME];
     if (isset($mysql_data[DOC_LAST_MODIFIED]) && $mysql_data[DOC_MIME_TYPE] != 0) {
         $lm = $mysql_data[DOC_LAST_MODIFIED];
     }
     $data["mimetype"] = $mime;
     $data["lastmodified"] = $lm;
     $data["name"] = $mysql_data[OBJ_NAME];
     $data["contentsize"] = $this->get_content_size($this->get_content_id($id));
     return $data;
 }
Example #7
0
 public function logout()
 {
     $this->logged_in = FALSE;
     // NEW ENTRY IN LOGFILE
     logging::write_log(LOG_MESSAGES, "LOGOUT\t\t" . $this->login);
 }
Example #8
0
    throw new Exception(str_replace("%USER", $user->get_login(), sr_replace("%GROUP", $group->get_id(), gettext("Access denied: User %USER has no right to delete the group %GROUP"))), E_USER_RIGHTS);
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $values = $_POST["values"];
    $env = $steam_group->get_environment();
    $upper_link = PATH_URL . "groups/" . (is_object($env) ? "?cat=" . $env->get_id() : "");
    $group_name = $group->get_display_name();
    $members = $group->get_members();
    $inventory = $group->get_workroom()->get_inventory_raw();
    $deleted = TRUE;
    foreach ($inventory as $object) {
        if (!$object instanceof steam_user) {
            try {
                lms_steam::delete($object);
            } catch (Exception $ex3) {
                logging::write_log(LOG_DEBUGLOG, "groups_delete:error deleting object from group workroom\t" . $login . " \t" . $group->get_display_name() . " \t" . $steam_group->get_id() . " \t" . $object->get_id());
            }
        }
    }
    if ($steam_group->delete()) {
        $user->get_attributes(array(OBJ_NAME, USER_FIRSTNAME, USER_FULLNAME));
        foreach ($members as $member) {
            $cache = get_cache_function($member->get_name());
            $cache->drop("lms_steam::user_get_groups", $member->get_name(), TRUE);
            $cache->drop("lms_steam::user_get_groups", $member->get_name(), FALSE);
            $cache->drop("lms_steam::user_get_profile", $member->get_name());
            $cache->drop("lms_portal::get_menu_html", $member->get_name(), TRUE);
        }
        $cache = get_cache_function($steam_group->get_id());
        $cache->drop("lms_steam::group_get_members", $steam_group->get_id());
        foreach ($members as $member) {
Example #9
0
<?php

if (!$course->is_staff(lms_steam::get_current_user()) && !lms_steam::is_koala_admin(lms_steam::get_current_user())) {
    throw new Exception("No rights to view this.", E_USER_RIGHTS);
}
require_once "Spreadsheet/Excel/Writer.php";
$cache = get_cache_function($unit->get_id(), CACHE_LIFETIME_STATIC);
$participant_group = $unit->get_attribute("UNIT_POINTLIST_PARTICIPANTS");
$proxy = $unit->get_attribute("UNIT_POINTLIST_PROXY");
if (defined("LOG_DEBUGLOG")) {
    $time1 = microtime(TRUE);
    $login = lms_steam::get_current_user()->get_name();
    logging::write_log(LOG_DEBUGLOG, "units_pointlist_excel:\t " . $login . "\t" . $unit->get_display_name() . "\t" . $participant_group->get_identifier() . "\t" . $participant_group->count_members() . "\t" . date("d.m.y G:i:s", time()) . "... ");
}
$members = $cache->call("lms_steam::group_get_members", $participant_group->get_id(), TRUE);
// INITIALIZATION
$course_id = $course->get_course_id();
$course_name = $course->get_course_name();
$semester = $course->get_semester();
$proxy_data = $proxy->get_all_attributes();
$points = units_pointlist::extract_pointlist($proxy_data);
$maxpoints = $proxy_data["UNIT_POINTLIST_MAXPOINTS"];
$count = $unit->get_attribute("UNIT_POINTLIST_COUNT");
$bonus_1 = $unit->get_attribute("UNIT_POINTLIST_BONUS_1");
$bonus_2 = $unit->get_attribute("UNIT_POINTLIST_BONUS_2");
$unit_name = $unit->get_display_name();
$excel = new Spreadsheet_Excel_Writer();
$excel->setTempDir(PATH_TEMP);
$format_table_header =& $excel->addFormat(array('Size' => 12, 'Align' => 'left', 'Bold' => 1));
$format_table_header_number =& $excel->addFormat(array('Size' => 12, 'Align' => 'right', 'Bold' => 1));
$sheet_table_header =& $excel->addFormat(array('Size' => 14, 'Align' => 'left'));
Example #10
0
 public function search_user_posts($messageboard_id, $user_name)
 {
     if (defined("LOG_DEBUGLOG")) {
         $time1 = microtime(TRUE);
         logging::write_log(LOG_DEBUGLOG, "lms_forum::search_user_posts(" . $messageboard_id . ", " . $user_name . ") \t" . $GLOBALS["STEAM"]->get_login_user_name() . " \t" . $messageboard_id . " \t... ");
     }
     if (!($search_mod = $GLOBALS["STEAM"]->get_module("package:searchsupport"))) {
         throw new Exception("sTeam 'package:searchsupport' not installed.");
     }
     $messageboard = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $messageboard_id, CLASS_MESSAGEBOARD);
     $user = steam_factory::username_to_object($GLOBALS["STEAM"]->get_id(), $user_name);
     $search_results = $GLOBALS["STEAM"]->predefined_command($search_mod, "search_user_posts", array($messageboard, $user), 0);
     $result = lms_forum::get_discussions($messageboard->get_id(), $search_results);
     if (defined("LOG_DEBUGLOG")) {
         logging::append_log(LOG_DEBUGLOG, " \t" . round((microtime(TRUE) - $time1) * 1000) . " ms \t" . count($result));
     }
     return $result;
 }
Example #11
0
function get_document_data($login, $password, $identifier, $identifier_type, $width = false, $height = false)
{
    $STEAM = new steam_connector(STEAM_SERVER, STEAM_PORT, $login, $password);
    if ($identifier_type === "name") {
        $document = $STEAM->predefined_command($STEAM->get_module("icons"), "get_icon_by_name", array((string) $identifier), 0);
    } else {
        if ($identifier_type === "id") {
            $document = steam_factory::get_object($STEAM->get_id(), (int) $identifier);
        }
    }
    // If user is not logged in, open login dialog. If user is logged in
    // and not guest, then display "Access denied" message.
    if (!$document->check_access_read($STEAM->get_current_steam_user())) {
        if ($login == 'guest') {
            throw new Exception("Access denied. Please login.", E_USER_AUTHORIZATION);
        } else {
            throw new Exception("Access denied.", E_USER_RIGHTS);
        }
    }
    if (!is_object($document)) {
        return array("content" => array());
    }
    // array is considered to be an error
    $document->get_attributes(array("OBJ_NAME", "DOC_MIME_TYPE", "DOC_LAST_MODIFIED"), TRUE);
    if (!$width && !$height) {
        //$tnr_content = $document->get_content(TRUE);  // workaround: get data from sTeam webinterface
        $tnr_contentsize = $document->get_content_size(TRUE);
    } else {
        $tnr_imagecontent = $document->get_thumbnail_data($width, $height, 0, TRUE);
    }
    $result = $STEAM->buffer_flush();
    if (isset($tnr_imagecontent)) {
        // handle thumbnail data
        $data["mimetype"] = $result[$tnr_imagecontent]["mimetype"];
        $data["lastmodified"] = $result[$tnr_imagecontent]["timestamp"];
        $data["name"] = $result[$tnr_imagecontent]["name"];
        $data["content"] = $result[$tnr_imagecontent]["content"];
        $data["contentsize"] = $result[$tnr_imagecontent]["contentsize"];
    } else {
        if ($identifier_type === "id") {
            $data["mimetype"] = $document->get_attribute("DOC_MIME_TYPE");
            $data["lastmodified"] = $document->get_attribute("DOC_LAST_MODIFIED");
            $data["name"] = $document->get_name();
            $data["contentsize"] = $result[$tnr_contentsize];
            //$data["content"]     = $result[$tnr_content];  // workaround: get data from sTeam webinterface
            // workaround: get content from sTeam webinterface, because
            //$data["content"] = $document->get_content();
            //   results in *huge* memory overheads (a 15 MB download fails with 60 MB scrip memory limit!
            if (defined("LOG_DEBUGLOG")) {
                $time1 = microtime(TRUE);
                logging::write_log(LOG_DEBUGLOG, "get_document::get_document_data(" . $login . ", *****" . ", " . $identifier . ", " . $identifier_type . ", false, false)\t " . $login . " \t" . $identifier . " \t" . $document->get_name() . " \t" . $data["contentsize"] . " Bytes \t... ");
            }
            $https_port = (int) $STEAM->get_config_value("https_port");
            if ($https_port == 443 || $https_port == 0) {
                $https_port = "";
            } else {
                $https_port = ":" . (string) $https_port;
            }
            $ch = curl_init("https://" . STEAM_SERVER . $https_port . "/scripts/get.pike?object=" . $identifier);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
            curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
            curl_setopt($ch, CURLOPT_USERPWD, $login . ":" . $password);
            $data["content"] = curl_exec($ch);
            curl_close($ch);
            if (defined("LOG_DEBUGLOG")) {
                logging::append_log(LOG_DEBUGLOG, " \t" . round((microtime(TRUE) - $time1) * 1000) . " ms");
            }
        } else {
            $data = array("content" => array());
            // array is considered an error
        }
    }
    return $data;
}
Example #12
0
if (!$downloader->check_permissions($login, $identifier, $password)) {
    if ($login == 'guest') {
        throw new Exception("Access denied. Please login.", E_USER_AUTHORIZATION);
    } else {
        throw new Exception("No rights to download object " . $identifier . ".", E_USER_RIGHTS);
    }
}
$data = $downloader->get_document_attributes($identifier);
//        print_r($data);
//	print("name=" .  $data["name"] 	);
//        exit();
header("Pragma: private");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: " . $data["mimetype"]);
header("Content-Length:" . $data["contentsize"]);
// The line below forces the Browser's "Save as..." Dialog to pop up
if (isset($_GET["filename"])) {
    //download was started using "/download/<id>/<filename>/" use <filename> as name
    header("Content-Disposition: filename=\"" . $_GET["filename"] . "\"");
} else {
    header("Content-Disposition: attachment; filename=\"" . $data["name"] . "\"");
}
ob_flush();
if (defined("LOG_DEBUGLOG")) {
    $time1 = microtime(TRUE);
    logging::write_log(LOG_DEBUGLOG, "get_document_database:mysql\t" . $login . " \t" . $identifier . " \t" . $data["name"] . " \t" . $data["contentsize"] . " Bytes \t... ");
}
$downloader->download_and_print($identifier, $login);
if (defined("LOG_DEBUGLOG")) {
    logging::append_log(LOG_DEBUGLOG, " \t" . round((microtime(TRUE) - $time1) * 1000) . " ms");
}
Example #13
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $group_id = $this->params[0];
     $portal = \lms_portal::get_instance();
     $portal->initialize(GUEST_NOT_ALLOWED);
     $user = \lms_steam::get_current_user();
     //TODO: Was soll dieses $em hier??
     //$em = \lms_steam::get_extensionmanager();
     if (!($steam_group = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $group_id))) {
         include "bad_link.php";
         exit;
     }
     if (!$steam_group instanceof \steam_group) {
         throw new \Exception("Is not a group: " . $_GET["id"]);
     }
     $group = \koala_object::get_koala_object($steam_group);
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         if ($group instanceof \koala_group_course && !($group->is_staff($user) || $group->is_learner($user))) {
             //throw new \Exception( $user->get_name() . " is not a member of " . $group->get_groupname() );
             header("Location: " . $values["return_to"]);
             exit;
         }
         if ($group instanceof \koala_group_default && !$group->is_member($user)) {
             //throw new \Exception( $user->get_name() . " is not a member of " . $group->get_groupname() );
             header("Location: " . $values["return_to"]);
             exit;
         }
         $values = $_POST["values"];
         if (defined("LOG_DEBUGLOG")) {
             \logging::write_log(LOG_DEBUGLOG, "group_cancel\t" . $user->get_name() . " leaves " . $steam_group->get_identifier());
         }
         \logging::start_timer("leave_group");
         if ($group->remove_member($user)) {
             $group_name = $group->get_display_name();
             $short_confirmation = str_replace("%GROUP", $group_name, gettext("Your membership in the group '%GROUP' has been terminated."));
             $confirmation = str_replace("%NAME", $user->get_full_name(), gettext("Dear %NAME,")) . "\n\n" . $short_confirmation . "\n\n" . gettext("Your koaLA Team");
             \lms_steam::mail($user, "\"" . PLATFORM_NAME . " System\"<no_reply@" . STEAM_SERVER . ">", PLATFORM_NAME . ": " . str_replace("%GROUP", $group_name, gettext("Your membership in the group '%GROUP' has been terminated")), $confirmation);
             $cache = get_cache_function($user->get_name());
             $cache->drop("lms_steam::user_get_groups", $user->get_name(), TRUE);
             $cache->drop("lms_steam::user_get_groups", $user->get_name(), FALSE);
             $cache->drop("lms_steam::user_get_profile", $user->get_name());
             $cache->drop("lms_portal::get_menu_html", $user->get_name(), TRUE);
             $cache = get_cache_function($group->get_id());
             $cache->drop("lms_steam::group_get_members", $group->get_id());
             $_SESSION["confirmation"] = $short_confirmation;
             if (defined("LOG_DEBUGLOG")) {
                 \logging::append_log(LOG_DEBUGLOG, " runtime=" . \logging::print_timer("leave_group"));
             }
             header("Location: " . $values["return_to"]);
             exit;
         } else {
             throw new \Exception("Cannot delete membership.");
         }
         if (defined("LOG_DEBUGLOG")) {
             \logging::append_log(LOG_DEBUGLOG, "failed. runtime=" . \logging::print_timer("leave_group"));
         }
     }
     $content = \Group::getInstance()->loadTemplate("groups_cancel_membership.template.html");
     $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
     $content->setVariable("LABEL_RETURN", gettext("back"));
     if ($group instanceof \koala_group_course && !($group->is_staff($user) || $group->is_learner($user))) {
         if (empty($_SESSION['confirmation'])) {
             // don't warn if we came here on successful membership cancel...
             if ($group instanceof \koala_group_course) {
                 $portal->set_problem_description(gettext("You are not member of this course."));
             } else {
                 $portal->set_problem_description(gettext("You are not member of this group."));
             }
         }
     } else {
         if ($group instanceof \koala_group_default && !$group->is_member($user)) {
             if (empty($_SESSION['confirmation'])) {
                 // don't warn if we came here on successful membership cancel...
                 if ($group instanceof \koala_group_course) {
                     $portal->set_problem_description(gettext("You are not member of this course."));
                 } else {
                     $portal->set_problem_description(gettext("You are not member of this group."));
                 }
             }
         } else {
             $redirect = $_SERVER["HTTP_REFERER"];
             if ($group instanceof \koala_group_default && !$group->is_public()) {
                 $redirect = PATH_URL . "user/" . \lms_steam::get_current_user()->get_name() . "/groups/";
             }
             $content->setVariable("DELETE_BACK_LINK", $redirect);
             $content->setVariable("FORM_ACTION", PATH_URL . "group/cancelGroup/\t" . $group_id);
             $content->setVariable("LABEL_ARE_YOU_SURE", gettext("Are you sure?"));
             $content->setVariable("INFO_CANCEL_MEMBERSHIP", str_replace("%NAME", $group->get_display_name(), gettext("You are going to cancel your membership in <b>'%NAME'</b>.")));
             $content->setVariable("BUTTON_SUBMIT", "<input type=\"submit\" name=\"values[delete]\"  value=\"" . gettext("Yes, cancel my membership") . "\"/>");
         }
     }
     /*
     $portal->set_page_main(
     								"",
     								$content->get(),
     								""
     								);
     $portal->show_html();
     */
     $frameResponseObject->setTitle("Group");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Example #14
0
 $is_buddy = FALSE;
 if (!is_array($buddies)) {
     $buddies = array();
 }
 foreach ($buddies as $buddy) {
     if (is_object($buddy) && $buddy->get_id() == $id) {
         //throw new Exception( "User is in buddy list yet." );
         $is_buddy = TRUE;
     }
 }
 if (!$is_buddy) {
     $buddies[] = $contact;
     $user->set_attribute("USER_FAVOURITES", $buddies);
 }
 $contact->contact_confirm();
 logging::write_log(LOG_MESSAGES, "CONFIRMED\t" . $user->get_name() . "\t" . $contact->get_name());
 $message = str_replace("%NAME", $user_attributes["USER_FIRSTNAME"] . " " . $user_attributes["USER_FULLNAME"], gettext("%NAME has confirmed you as a contact."));
 $message .= " " . gettext("You can visit her/his profile here:");
 $message .= " <a href=\"" . PATH_URL . "user/" . $user->get_name() . "/\">";
 $message .= str_replace("%NAME", $user_attributes["USER_FIRSTNAME"] . " " . $user_attributes["USER_FULLNAME"], gettext("%NAME's profile")) . "</a>";
 //$contact->mail( "LLMS: " . str_replace( "%NAME", $user_attributes[ "USER_FIRSTNAME" ] . " " . $user_attributes[ "USER_FULLNAME" ], gettext( "%NAME has confirmed your contact" ) ), $message, $user_attributes[ "USER_EMAIL" ] );
 lms_steam::mail($contact, $user, PLATFORM_NAME . ": " . str_replace("%NAME", $user_attributes["USER_FIRSTNAME"] . " " . $user_attributes["USER_FULLNAME"], gettext("%NAME has confirmed your contact")), $message);
 // require_once( "Cache/Lite.php" );
 // $cache = new Cache_Lite( array( "cacheDir" => PATH_CACHE ) );
 $cache = get_cache_function($user->get_name());
 $cache->clean($user->get_name());
 $cache->clean($user->get_id());
 $cache = get_cache_function($contact->get_name());
 $cache->clean($contact->get_name());
 $cache->clean($contact->get_id());
 $_SESSION["confirmation"] = str_replace("%NAME", $contact->get_name(), gettext("Confirmed contact request from %NAME"));
Example #15
0
}
$group = koala_object::get_koala_object($steam_group);
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if ($group instanceof koala_group_course && !($group->is_staff($user) || $group->is_learner($user))) {
        //throw new Exception( $user->get_name() . " is not a member of " . $group->get_groupname() );
        header("Location: " . $values["return_to"]);
        exit;
    }
    if ($group instanceof koala_group_default && !$group->is_member($user)) {
        //throw new Exception( $user->get_name() . " is not a member of " . $group->get_groupname() );
        header("Location: " . $values["return_to"]);
        exit;
    }
    $values = $_POST["values"];
    if (defined("LOG_DEBUGLOG")) {
        logging::write_log(LOG_DEBUGLOG, "group_cancel\t" . $user->get_name() . " leaves " . $steam_group->get_identifier());
    }
    logging::start_timer("leave_group");
    if ($group->remove_member($user)) {
        $group_name = $group->get_display_name();
        $short_confirmation = str_replace("%GROUP", $group_name, gettext("Your membership in the group '%GROUP' has been terminated."));
        $confirmation = str_replace("%NAME", $user->get_full_name(), gettext("Dear %NAME,")) . "\n\n" . $short_confirmation . "\n\n" . gettext("Your koaLA Team");
        lms_steam::mail($user, "\"" . PLATFORM_NAME . " System\"<no_reply@" . STEAM_SERVER . ">", PLATFORM_NAME . ": " . str_replace("%GROUP", $group_name, gettext("Your membership in the group '%GROUP' has been terminated")), $confirmation);
        $cache = get_cache_function($user->get_name());
        $cache->drop("lms_steam::user_get_groups", $user->get_name(), TRUE);
        $cache->drop("lms_steam::user_get_groups", $user->get_name(), FALSE);
        $cache->drop("lms_steam::user_get_profile", $user->get_name());
        $cache->drop("lms_portal::get_menu_html", $user->get_name(), TRUE);
        $cache = get_cache_function($group->get_id());
        $cache->drop("lms_steam::group_get_members", $group->get_id());
        $_SESSION["confirmation"] = $short_confirmation;
Example #16
0
        $student = $result[0];
    } else {
        // Benutzer hat sich noch nie in sTeam eingeloggt.
        continue;
    }
    $steam_group = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $booking->course_id_koala, 0);
    $course = new koala_group_course($steam_group);
    // KURSAUSTRITT AUCH IN KOALA MIT UEBERNEHMEN
    if ($course->remove_member($student)) {
        $message = str_replace("%NAME", $student->get_attribute("USER_FIRSTNAME") . " " . $student->get_attribute("USER_FULLNAME"), gettext("Hallo %NAME,")) . "\n\n";
        $message .= str_replace("%GROUP", $course->get_name(), gettext("You have been removed from the course '%GROUP' because of your membership data in the HIS LSF system.")) . "\n\n";
        $message .= gettext("This is an automatically generated email.");
        lms_steam::mail($student, lms_steam::get_current_user(), PLATFORM_NAME . ": " . str_replace("%GROUP", $course->get_name(), gettext("You have been removed from the course '%GROUP'.")), $message);
        $query = "DELETE FROM " . SYNC_TABLE_NAME . " WHERE id='" . $booking->id . "';";
        if (mysql_query($query)) {
            $counter_deleted_bookings++;
        }
    } else {
        print "konnte nicht geloescht werden.";
    }
}
// LOGGING
try {
    logging::write_log(LOG_HISLSFSYNC, "HISLSF_SYNC\tDeleted bookings: " . $counter_deleted_bookings);
    logging::write_log(LOG_HISLSFSYNC, "HISLSF_SYNC\t=== END ===");
} catch (Exception $e) {
    error_log($e->getTraceAsString());
    print "Cannot write Log-File! ";
    print "Please check if " . LOG_HISLSFSYNC . " is writable.";
    exit;
}
Example #17
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     if (!($env = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_GET["env"]))) {
         throw new \Exception("Environment unknown.");
     }
     $koala_env = \koala_object::get_koala_object($env);
     if (isset($_SERVER["HTTP_REFERER"])) {
         $http_referer = $_SERVER["HTTP_REFERER"];
     } else {
         $http_referer = "";
     }
     $backlink = empty($_POST["values"]["backlink"]) ? $http_referer : $_POST["values"]["backlink"];
     $max_file_size = parse_filesize(ini_get('upload_max_filesize'));
     $max_post_size = parse_filesize(ini_get('post_max_size'));
     if ($max_post_size > 0 && $max_post_size < $max_file_size) {
         $max_file_size = $max_post_size;
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = isset($_POST["values"]) ? $_POST["values"] : array();
         $problems = "";
         $hints = "";
         if (empty($_FILES) || !empty($_FILES["material"]["error"]) && $_FILES["material"]["error"] > 0) {
             if (!empty($_FILES) && empty($_FILES["material"]["name"])) {
                 $problems = gettext("No file chosen.") . " ";
                 $hints = gettext("Please choose a local file to upload.") . " ";
             } else {
                 $problems = gettext("Could not upload document.") . " ";
                 $hints = str_replace(array("%SIZE", "%TIME"), array(readable_filesize($max_file_size), (string) ini_get('max_execution_time')), gettext("Maybe your document exceeded the allowed file size (max. %SIZE) or the upload might have taken too long (max. %TIME seconds).")) . " ";
             }
         }
         if (empty($problems)) {
             $content = file_get_contents($_FILES["material"]["tmp_name"]);
             /*
             ob_start();
             readfile( $_FILES["material"]["tmp_name"] );
             $content = ob_get_contents();
             ob_end_clean();
             */
             if (defined("LOG_DEBUGLOG")) {
                 $time1 = microtime(TRUE);
                 \logging::write_log(LOG_DEBUGLOG, "upload" . " \t" . $GLOBALS["STEAM"]->get_login_user_name() . " \t" . $_FILES["material"]["name"] . " \t" . filesize($_FILES["material"]["tmp_name"]) . " Bytes \t... ");
             }
             $filename = str_replace(array("\\", "'"), array("", ""), $_FILES["material"]["name"]);
             $new_material = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $filename, $content, $_FILES["material"]["type"], FALSE);
             if (defined("LOG_DEBUGLOG")) {
                 \logging::append_log(LOG_DEBUGLOG, " \t" . round((microtime(TRUE) - $time1) * 1000) . " ms");
             }
             //  Disabled for Testing issues
             // upload($new_material->get_content_id(), $content);
             if (isset($values["dsc"])) {
                 $new_material->set_attribute("OBJ_DESC", $values["dsc"]);
             }
             $new_material->move($env);
             $_SESSION["confirmation"] = str_replace("%DOCUMENT", h($filename), gettext("'%DOCUMENT' has been uploaded."));
             header("Location: " . $backlink);
             exit;
         } else {
             $frameResponseObject->setProblemDescription($problems);
             $frameResponseObject->setProblemSolution($hints);
             //$portal->set_problem_description( $problems, $hints );
         }
     }
     $content = \Wiki::getInstance()->loadTemplate("upload.template.html");
     //$content = new HTML_TEMPLATE_IT( PATH_TEMPLATES );
     //$content->loadTemplateFile( "upload.template.html" );
     $content->setVariable("LABEL_UPLOAD", gettext("Upload"));
     $content->setVariable("LABEL_FILE", gettext("Local file"));
     $content->setVariable("LABEL_DSC", gettext("Description"));
     $content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
     $content->setVariable("BACK_LINK", $backlink);
     $content->setVariable("FORM_ACTION", PATH_URL . "wiki/upload/" . (isset($_GET["env"]) ? "?env=" . $_GET["env"] : ""));
     if ($max_file_size > 0) {
         $content->setVariable("MAX_FILE_SIZE_INPUT", "<input type='hidden' name='MAX_FILE_SIZE' value='" . (string) $max_file_size . "'/>");
         $content->setVariable("MAX_FILE_SIZE_INFO", "<br />" . str_replace("%SIZE", readable_filesize($max_file_size), gettext("The maximum allowed file size is %SIZE.")));
     }
     $link_path = $koala_env->get_link_path();
     if (!is_array($link_path)) {
         $link_path = array();
     }
     $link_path[] = array("name" => gettext("Upload document"));
     if (!WIKI_FULL_HEADLINE) {
         $tmp_array = array();
         $elem_last = array_pop($link_path);
         $elem_first = array_pop($link_path);
         $tmp_array[] = $elem_first;
         $tmp_array[] = $elem_last;
         $link_path = $tmp_array;
     }
     //$portal->set_page_main( $link_path, $content->get() );
     //$portal->set_page_main( str_replace( "%ENV", $env->get_name(), gettext( "New upload in '%ENV'" ) ), $content->get() );
     //$portal->set_page_title( gettext( "Upload document" ) );
     //$portal->show_html();
     $frameResponseObject->setHeadline($link_path);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Example #18
0
 public function show_html()
 {
     // GENERATE HTML FOR MENU
     if ($this->offline_status) {
         $html_menu = $this->get_menu_html("guest", FALSE);
         $this->template->setVariable("MENU_HTML", $html_menu);
     } else {
         $cache = get_cache_function($this->lms_user->get_login(), 600);
         $html_menu = $cache->call("lms_portal::get_menu_html", $this->lms_user->get_login(), $this->lms_user->is_logged_in());
         $this->template->setVariable("MENU_HTML", $html_menu);
         $html_icon_bar = lms_portal::$instance->get_icon_bar_html($this->lms_user->is_logged_in());
         $this->template->setVariable("ICON_BAR_HTML", $html_icon_bar);
     }
     if ($this->prototype_enabled) {
         $this->template->setCurrentBlock('HEAD_JAVASCRIPT_PROTOTYPE');
         $this->template->setVariable("PATH_JAVASCRIPT_2", PATH_JAVASCRIPT);
         $this->template->setVariable("KOALA_VERSION_2", KOALA_VERSION);
         $this->template->parse('HEAD_JAVASCRIPT_PROTOTYPE');
     }
     try {
         while (ob_get_level() > 0) {
             ob_end_flush();
         }
     } catch (Exception $e) {
     }
     if ($_SESSION["STATISTICS_LEVEL"] > 0) {
         // output number of open-sTeam requests:
         $this->template->setVariable("STATISTICS_REQUESTS", " | " . (isset($GLOBALS["STEAM"]) ? $GLOBALS["STEAM"]->get_request_count() : "nc") . " " . gettext("server requests"));
         // output time taken to produce page:
         if ($_SESSION["STATISTICS_LEVEL"] > 1 && isset($GLOBALS["page_time_start"])) {
             $this->template->setVariable("STATISTICS_PAGETIME", " | " . gettext("page took") . " " . round((microtime(TRUE) - $GLOBALS["page_time_start"]) * 1000) . " ms");
         }
     }
     if (JAVASCRIPT_SECURITY) {
         define("SHOW_SECURITY_PROBLEMS", FALSE);
         //find body
         preg_match_all("/(<body.*?<\\/body>)/is", $this->template->get(), $b_result);
         //logging script
         preg_match_all("/(<script.{0,100})/is", $b_result[1][0], $r_script);
         $scripts = $r_script[1];
         foreach ($scripts as $script) {
             logging::write_log(LOG_SECURITY, "found script in " . $_SERVER["SCRIPT_NAME"] . " user:"******"\n\t\t" . $script . "...");
             if (SHOW_SECURITY_PROBLEMS) {
                 echo "<pre style=\"color:red;\">" . "found script " . htmlspecialchars($script) . "</pre>";
             }
         }
         //loggin link
         preg_match_all("/(<link.{0,100})/is", $b_result[1][0], $r_link);
         $links = $r_link[1];
         foreach ($links as $link) {
             logging::write_log(LOG_SECURITY, "found link in " . $_SERVER["SCRIPT_NAME"] . " user:"******"\n\t\t" . $link . "...");
             if (SHOW_SECURITY_PROBLEMS) {
                 echo "<pre style=\"color:red;\">" . "found link " . htmlspecialchars($link) . "</pre>";
             }
         }
         //remove <script
         $clean_body = str_replace("<script", "", $b_result[1][0]);
         //remove <link
         $clean_body = str_replace("<link", "", $clean_body);
         $clean_html = preg_replace("/(<body.*?<\\/body>)/is", $clean_body, $this->template->get());
         //remove <... on...="..." onload, onclick, etc.
         preg_match_all("/<body[^>]*>(.*)<\\/body>/is", $clean_html, $b_result);
         $body_content = $b_result[1][0];
         preg_match_all("/<[^>]*(\\s(on\\w*=((\"[^\"]*\")|('[^']*'))))+/is", $body_content, $on_result);
         $ons = $on_result[1];
         foreach ($ons as $on) {
             logging::write_log(LOG_SECURITY, "found on*** in " . $_SERVER["SCRIPT_NAME"] . " user:"******"\n\t\t" . $on);
             if (SHOW_SECURITY_PROBLEMS) {
                 echo "<pre style=\"color:red;\">" . "found on*** " . htmlspecialchars($on) . "</pre>";
             }
         }
         $body_content = preg_replace("/<[^>]*\\s(on\\w*=((\"[^\"]*\")|('[^']*')))/is", "", $body_content);
         preg_match_all("/(<body[^>]*>)/is", $clean_html, $r);
         $body_start = $r[1][0];
         $clean_html = preg_replace("/<body[^>]*>.*<\\/body>/is", $body_start . $body_content . "</body>", $clean_html);
         return print $clean_html;
     } else {
         return $this->template->show();
     }
 }
Example #19
0
 /**
  * function mail:
  *
  * Sends a message to the user through the open sTeam mail system.
  * If the Recipient is a Group the mail will be delivered to all groupmembers.
  * A Copy of this message will be stored within the steam mailbox of the user.
  * If the user has set its attribute USER_FORWARD_MSG as true, this message
  * will be delivered also as e-mail to its account.
  *
  * As this Method reads some values from the parameter $pSender (in case
  * $pSender is an object) it is not allowed to call this method using the
  * buffer of the steam_connector.
  *
  * The E-Mail was sent as text/html in any case. The given messagebody will be
  * converted to html by default
  *
  * @param Object  $pUserOrGroup a user or a group to send the given mail to
  * @param String  $pSubject message's subject
  * @param String  $pMessageBody Message. As Plaintext by default.
  * @param Object_or_String  $pSender The user sending the E-Mail or a string
  * containing the sender as string in teh following format: "\"" . $name .
  * "\"<*****@*****.**>" with $name as printed quotable encoded string. You
  * may use steam_connector::quoted_printable_encode() to encode the name
  * correctly. An Example: $userobject->mail( "a subject", " a message", "\"" .
  * steam_connector::quoted_printable_encode("Firstname Lastname") . "\"<*****@*****.**>");
  * @param String  $pMimeType The mimetype of the given Messagebody
  */
 public function mail($pUserOrGroup, $pSender = 0, $pSubject, $pMessageBody, $pMimeType = "text/plain")
 {
     if (!SYSTEMCONFIG_FUNCTION_MAIL) {
         logging::write_log(LOG_MESSAGES, "Mail function is disabled. Mail " . $pSubject . " wasn't sent.");
         return;
     }
     if (!is_object($pUserOrGroup)) {
         throw new Exception("Invalid Recipient of E-Mail in lms_steam::mail()", E_PARAMETER);
     }
     if (strtolower($pUserOrGroup->get_name()) == "steam") {
         $time1 = microtime(TRUE);
         logging::write_log(LOG_MESSAGES, "lms_steam::mail()\tSPOOF\tAttempt to send mail to steam group \tname=" . lms_steam::get_current_user()->get_name() . " (id=" . lms_steam::get_current_user()->get_id() . ")\tsubject=" . $pSubject . "\tbody=" . $pMessageBody);
         throw new Exception("Invalid Recipient of E-Mail in lms_steam::mail():  Sending Mails to group steam is vorbidden", E_USER_RIGHTS);
     }
     if (is_object($pSender)) {
         // Construct valid Sender-String as it is used within the koaLA System
         // Firstname, Lastname and USER_EMAIL
         $pSender->get_attributes(array("USER_FULLNAME", "USER_FIRSTNAME", "USER_EMAIL"));
         $name = $pSender->get_attribute("USER_FIRSTNAME") . " " . $pSender->get_attribute("USER_FULLNAME");
         // Provide the correct encoding (quoted printable)
         // Hint: your PHP installation must have ctype_alpha
         // TODO: Enable if LDAP returns umlauts in first and lastname. Check
         // wether the given string contains only ascii chars and skip the
         // encoding to reduce SPAM Score
         // $name = steam_connector::quoted_printable_encode($name);
         // construct a valid senderstring to avoid SPAM Rating
         $senderstring = "\"" . $name . "\"" . "<" . $pSender->get_attribute(USER_EMAIL) . ">";
     } elseif (is_string($pSender)) {
         $senderstring = $pSender;
     } else {
         throw new Exception("Invalid Sender of E-Mail in lms_steam::mail()", E_PARAMETER);
     }
     if ($pMimeType === "text/plain") {
         // replace linebreaks with <br />
         $HtmlMessageBody = str_replace("\n", "", nl2br(str_replace("\r\n", "\n", $pMessageBody)));
     } else {
         $HtmlMessageBody = $pMessageBody;
     }
     // send the mail to the user or group
     //error_log("lms_steam::mail(): sending email. subject=" . $pSubject . " messagebody=" . $HtmlMessageBody . " senderstring=" . $senderstring);
     $pUserOrGroup->mail($pSubject, $HtmlMessageBody, $senderstring);
 }
Example #20
0
 $values = $_POST["values"];
 $problems = "";
 $hints = "";
 if (isset($values["password"])) {
     $password = $values["password"];
 } else {
     $password = "";
 }
 if (isset($values["message"])) {
     $message = $values["message"];
 } else {
     $message = "";
 }
 if (!$already_member_and_exclusive) {
     if (defined("LOG_DEBUGLOG")) {
         logging::write_log(LOG_DEBUGLOG, "group_subscribe\t" . $user->get_name() . " joins " . $steam_group->get_identifier());
     }
     logging::start_timer("join_group");
     $result = $group->subscribe($password, $message);
     if (defined("LOG_DEBUGLOG")) {
         logging::append_log(LOG_DEBUGLOG, " runtime=" . logging::print_timer("join_group"));
     }
     if ($result["succeeds"]) {
         $_SESSION['confirmation'] = $result['confirmation'];
         // uncache menu so that course/group appears:
         $cache = get_cache_function($user->get_name());
         $cache->drop("lms_steam::user_get_profile", $user->get_name());
         $cache->drop("lms_portal::get_menu_html", $user->get_name(), TRUE);
         if (!$group->is_member($user)) {
             $backlink = PATH_URL . 'desktop/';
         }
Example #21
0
function send_http_error($pException, $pBacktrace = "", $silent = false)
{
    if ($pException->getCode() == E_USER_ACCESS_DENIED) {
        logging::write_log(LOG_403, date("d.m.Y H:i", time()) . " USER: "******"USER"] . " " . "HTTP-" . $_SERVER['REQUEST_METHOD'] . ': ' . $_SERVER['REQUEST_URI']);
        header('Location: ' . PATH_URL . "403/");
        exit;
    }
    if ($pException->getCode() == E_USER_AUTHORIZATION) {
        try {
            while (ob_get_level() > 0) {
                ob_end_clean();
            }
        } catch (Exception $e) {
        }
        $protocoll = isset($_SERVER["HTTPS"]) ? "https://" : "http://";
        $url = $protocoll . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
        $request_url = str_ireplace(PATH_URL, "/", $url);
        $silent or header('Location: ' . URL_SIGNIN_REQUEST . substr($request_url, 1));
        exit;
    }
    if ($pException->getCode() == E_USER_DISCLAIMER) {
        try {
            while (ob_get_level() > 0) {
                ob_end_clean();
            }
        } catch (Exception $e) {
        }
        $protocoll = isset($_SERVER["HTTPS"]) ? "https://" : "http://";
        $url = $protocoll . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
        $request_url = str_ireplace(PATH_URL, "/", $url);
        $silent or header('Location: ' . PATH_URL . 'disclaimer_local.php?req=' . $request_url);
        exit;
    }
    if ($pException->getCode() == E_USER_CHANGE_PASSWORD) {
        try {
            while (ob_get_level() > 0) {
                ob_end_clean();
            }
        } catch (Exception $e) {
        }
        $silent or header('Location: ' . PATH_URL . 'usermanagement/user-password');
        //?req=' . $_SERVER[ 'REQUEST_URI' ] );
        exit;
    }
    if ($pException->getCode() != E_USER_RIGHTS) {
        $error_id = 'E' . strtoupper(uniqid('', FALSE));
        try {
            $user = 0;
            try {
                $user = lms_steam::get_current_user();
            } catch (Exception $x) {
            }
            $ustring = 'user is not a valid object (' . $_ENV["USER"] . ')';
            try {
                if (is_object($user) && $user instanceof steam_user) {
                    $ustring = $user->get_name();
                }
            } catch (Exception $e) {
                $ustring = '(id=' . $user->get_id() . ')';
            }
            if (lms_portal::is_instance() && is_object(lms_portal::get_instance()->get_user())) {
                $password = lms_portal::get_instance()->get_user()->get_password();
            } else {
                $password = "******";
            }
            $_SESSION["ERROR_ID"] = $error_id;
            if ($pBacktrace != "") {
                $backtrace = $pBacktrace;
            } else {
                $backtrace = $pException->getTraceAsString();
            }
            $backtrace = str_replace($password, "*****", $backtrace . "\n==============================");
            $_SESSION["ERROR_TEXT"] = 'ID: ' . $error_id . "\tCode: " . $pException->getCode() . "\nDate: " . date("d.m.Y H:i", time()) . "\nUser: "******"\nHTTP-" . $_SERVER['REQUEST_METHOD'] . ': ' . $_SERVER['REQUEST_URI'] . "\nBrowser: " . $_SERVER['HTTP_USER_AGENT'] . "\nMessage: " . $pException->getMessage() . "\nServer: " . PATH_SERVER . "\nPlatform: " . PLATFORM_ID . "\nBacktrace:\n" . $backtrace;
            $_SESSION["ERROR_REFERER"] = $_SERVER["REQUEST_URI"];
            if (defined("SEND_ERROR_MAIL") && SEND_ERROR_MAIL) {
                $subject = PLATFORM_NAME . " Error " . $_SESSION["ERROR_ID"];
                $header = "MIME-Version: 1.0\r\n" . "Content-type: text/plain; charset=utf-8\r\n" . "From: " . ERROR_MAIL_SENDER . "\r\n" . "X-Mailer: PHP/" . phpversion();
                mail(ERROR_MAIL_RECEIVER, '=?UTF-8?B?' . base64_encode($subject) . '?=', $_SESSION["ERROR_TEXT"], $header);
                logging::write_log(LOG_ERROR, "Error mail sent.");
            }
            logging::write_log(LOG_ERROR, $_SESSION["ERROR_TEXT"]);
        } catch (Exception $e) {
            echo "<pre>" . $e->getTraceAsString() . "</pre>";
            error_log($e->getTraceAsString());
            print 'Cannot write Log-File! ';
            print 'Please check if ' . LOG_ERROR . ' is writable. <br>';
            print 'ErrorMessage:<br><pre>';
            try {
                $password = lms_portal::get_instance()->get_user()->get_password();
            } catch (Exception $e) {
                $password = "******";
            }
            print 'ID: ' . $error_id . "\tCode: " . $pException->getCode() . "\nDate: " . date("d.m.Y H:i", time()) . "\nUser: "******"\nHTTP-" . $_SERVER['REQUEST_METHOD'] . ': ' . $_SERVER['REQUEST_URI'] . "\nBrowser: " . $_SERVER['HTTP_USER_AGENT'] . "\nMessage: " . $pException->getMessage() . "\nServer: " . PATH_SERVER . "\nPlatform: " . PLATFORM_ID . "\nBacktrace:\n" . str_replace($password, "*****", $pException->getTraceAsString() . "\n==============================");
            exit;
        }
    }
    try {
        while (ob_get_level() > 0) {
            ob_end_clean();
        }
    } catch (Exception $e) {
    }
    if (!isErrorPage()) {
        if (!headers_sent()) {
            if (!isset($error_id)) {
                $error_id = "missing";
            }
            if (!defined("URL_ERROR_REPORT")) {
                echo "Extension for error handling not loaded.<br><pre>" . $pException->getMessage() . "</pre>";
                die;
            } else {
                $silent or header('Location: ' . URL_ERROR_REPORT . $pException->getCode() . "/" . $error_id);
                die;
            }
        } else {
            //fallback if header already sent
            echo "<br /><br /><div style=\"color:red;font-size:small\">koala error handling: error occured but cannot redirect</div>";
            echo "Try to redirect with Javascript.<br>";
            echo "or go to error page by link: <a href=\"" . URL_ERROR_REPORT . $pException->getCode() . "/" . $error_id . "\">plattform error page</a>";
            echo "<script type=\"text/javascript\">window.location.href = '" . URL_ERROR_REPORT . $pException->getCode() . "/" . $error_id . "';</script>";
        }
    } else {
        echo "<h3>Deep Framework-Error - cannot display error page</h3>The last error, which could be restored. May be more.<pre>" . $_SESSION["ERROR_TEXT"] . "</pre>System terminated :-(";
    }
    exit;
}