Пример #1
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $user = \lms_steam::get_current_user();
     // Disable caching
     // TODO: Work on cache handling. An enabled cache leads to bugs
     // if used with the wiki.
     \CacheSettings::disable_caching();
     if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
         include "bad_link.php";
         exit;
     }
     if (!$wiki_container instanceof \steam_container) {
         $wiki_doc = $wiki_container;
         $wiki_container = $wiki_doc->get_environment();
         if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
             include "bad_link.php";
             exit;
         }
     }
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $compare = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[1]);
     $to = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[2]);
     $wiki_html_handler = new \lms_wiki($wiki_container);
     //$wiki_html_handler->set_admin_menu( "versions", $wiki_doc );
     $content = \Wiki::getInstance()->loadTemplate("wiki_version_compare.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "wiki_version_compare.template.html" );
     $difftext = wiki_diff_html($to, $compare);
     $content->setVariable("DIFF_TEXT", $difftext);
     $wiki_html_handler->set_main_html($content->get());
     $rootlink = \lms_steam::get_link_to_root($wiki_container);
     WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => PATH_URL . "wiki/versionoverview/" . $wiki_doc->get_id(), "name" => gettext("Version management")), array("link" => "", "name" => gettext("Version compare") . " (" . $compare->get_version() . " " . gettext("to") . " " . $to->get_version() . ")")) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => PATH_URL . "wiki/versionoverview/" . $wiki_doc->get_id() . "/versions/", "name" => gettext("Version management")), array("link" => "", "name" => gettext("Version compare") . " (" . $compare->get_version() . " " . gettext("to") . " " . $to->get_version() . ")")));
     /*$portal->set_page_main(
     		$headline,
     		$wiki_html_handler->get_html()
     		);
     		$portal->show_html();
     		*/
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($wiki_html_handler->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Пример #2
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $user = \lms_steam::get_current_user();
     // Disable caching
     // TODO: Work on cache handling. An enabled cache leads to bugs
     // if used with the wiki.
     \CacheSettings::disable_caching();
     if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
         include "bad_link.php";
         exit;
     }
     if (!$wiki_container instanceof \steam_container) {
         $wiki_doc = $wiki_container;
         $wiki_container = $wiki_doc->get_environment();
         if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
             include "bad_link.php";
             exit;
         }
     }
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     defined("OBJ_ID") or define("OBJ_ID", $wiki_container->get_id());
     $wiki_html_handler = new \lms_wiki($wiki_container);
     $wiki_html_handler->set_admin_menu("index", $wiki_container);
     $grp = $wiki_container->get_environment()->get_creator();
     if ($grp->get_name() == "learners" && $grp->get_attribute(OBJ_TYPE) == "course_learners") {
         $grp = $grp->get_parent_group();
     }
     $content = \Wiki::getInstance()->loadTemplate("wiki_entries.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "wiki_entries.template.html" );
     $cache = get_cache_function($wiki_container->get_id(), 600);
     $wiki_entries = $cache->call("lms_wiki::get_items", $wiki_container->get_id());
     $recently_changed = new \LinkedList(5);
     $most_discussed = new \LinkedList(5);
     $latest_comments = new \LinkedList(5);
     $no_wiki_entries = count($wiki_entries);
     if ($no_wiki_entries > 0) {
         $first_char = "";
         for ($i = 0; $i < $no_wiki_entries; $i++) {
             $this_char = substr(strtoupper($wiki_entries[$i]["OBJ_NAME"]), 0, 1);
             if ($this_char > $first_char) {
                 $first_char = $this_char;
                 if ($i > 1) {
                     $content->parse("BLOCK_CHARACTER");
                 }
                 $content->setCurrentBlock("BLOCK_CHARACTER");
                 $content->setVariable("FIRST_CHAR", h($this_char));
             }
             $char_articles = array();
             while ($i < $no_wiki_entries && $this_char == substr(strtoupper($wiki_entries[$i]["OBJ_NAME"]), 0, 1)) {
                 $char_articles[] = $wiki_entries[$i];
                 if ($recently_changed->can_be_added($wiki_entries[$i]["DOC_LAST_MODIFIED"])) {
                     $recently_changed->add_element($wiki_entries[$i]["DOC_LAST_MODIFIED"], $wiki_entries[$i]);
                 }
                 if (isset($wiki_entries[$i]["COMMENTS_NO"]) && $most_discussed->can_be_added($wiki_entries[$i]["COMMENTS_NO"]) && $wiki_entries[$i]["COMMENTS_NO"] > 1) {
                     $most_discussed->add_element($wiki_entries[$i]["COMMENTS_NO"], $wiki_entries[$i]);
                 }
                 if (isset($wiki_entries[$i]["COMMENTS_LAST"]) && $latest_comments->can_be_added($wiki_entries[$i]["COMMENTS_LAST"]) && $wiki_entries[$i]["COMMENTS_LAST"] > 0) {
                     $latest_comments->add_element($wiki_entries[$i]["COMMENTS_LAST"], $wiki_entries[$i]);
                 }
                 $i++;
             }
             $i--;
             $no_articles_in_first_row = ceil(count($char_articles) / 2);
             $content->setCurrentBlock("BLOCK_COLUMN");
             for ($c = 0; $c < $no_articles_in_first_row; $c++) {
                 $content->setCurrentBlock("BLOCK_ARTICLE");
                 $content->setVariable("ARTICLE_LINK", PATH_URL . "wiki/viewentry/" . $char_articles[$c]["OBJ_ID"] . "/");
                 $content->setVariable("ARTICLE_NAME", str_replace(".wiki", "", h($char_articles[$c]["OBJ_NAME"])));
                 $content->parse("BLOCK_ARTICLE");
             }
             $content->parse("BLOCK_COLUMN");
             $content->setCurrentBlock("BLOCK_COLUMN");
             for ($c = $no_articles_in_first_row; $c < count($char_articles); $c++) {
                 $content->setCurrentBlock("BLOCK_ARTICLE");
                 $content->setVariable("ARTICLE_LINK", PATH_URL . "wiki/viewentry/" . $char_articles[$c]["OBJ_ID"] . "/");
                 $content->setVariable("ARTICLE_NAME", str_replace(".wiki", "", h($char_articles[$c]["OBJ_NAME"])));
                 $content->parse("BLOCK_ARTICLE");
             }
             $content->parse("BLOCK_COLUMN");
             $content->parse("BLOCK_CHARACTER");
         }
         foreach ($wiki_entries as $entry) {
             $content->setCurrentBlock("BLOCK_ARTICLE");
             $content->setVariable("VALUE_WIKI_ENTRY", h($entry["OBJ_NAME"]));
             $content->setVariable("LINK_WIKI_ENTRY", PATH_URL . "wiki/viewentry/" . $wiki_container->get_id() . "/" . h($entry["OBJ_NAME"]));
             $content->setVariable("LABEL_LAST_MODIFICATION", gettext("last edited"));
             $content->setVariable("VALUE_POSTED_BY", $entry["DOC_USER_MODIFIED"]);
             $content->setVariable("POST_PERMALINK", PATH_URL . "wiki/viewentry/" . $entry["OBJ_ID"] . "/");
             $content->setVariable("VALUE_DATE_TIME", strftime("%x %X", $entry["OBJ_CREATION_TIME"]));
             $content->setVariable("POST_PERMALINK_LABEL", gettext("permalink"));
             $content->parse("BLOCK_ARTICLE");
         }
     }
     /* TODO: check if these functions can be deleted
     		 $wiki_html_handler->set_widget_latest_comments( $latest_comments );
     		 $wiki_html_handler->set_widget_last_changed( $recently_changed );
     		 $wiki_html_handler->set_widget_most_discussed( $most_discussed );
     		 $wiki_html_handler->set_widget_access( $grp );
     		 */
     //TODO: SET RSS_FEEDS
     WIKI_RSS ? $portal->set_rss_feed(PATH_URL . "services/feeds/wiki_public.php?id=" . OBJ_ID, gettext("Feed"), gettext("Subscribe to this forum's Newsfeed")) : "";
     $wiki_html_handler->set_main_html($content->get());
     $rootlink = \lms_steam::get_link_to_root($wiki_container);
     WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => "", "name" => h($wiki_container->get_name()))) : ($headline = array(array("link" => "", "name" => h($wiki_container->get_name()))));
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($wiki_html_handler->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Пример #3
0
        if ($width > 160) {
            $newHeight = (int) ($height * 160 / $width);
            $newWidth = 160;
        }
        if ($newHeight > 80) {
            $newWidth = (int) ($newWidth * 80 / $newHeight);
            $newHeight = 80;
        }
        $content->setCurrentBlock("BLOCK_IMAGE");
        $content->setVariable("IMAGE_NAME", $image->get_name());
        $content->setVariable("IMAGE_ID", $image->get_id());
        $content->setVariable("IMAGE_DESCRIPTION", $image->get_attribute('OBJ_DESC'));
        $content->setVariable("IMAGE_LINK", PATH_URL . "get_document.php?id=" . $image->get_id() . "&width=" . $newWidth . "&height=" . $newHeight);
        $content->setVariable("PREVIEW_LINK", "javascript:showBox(" . $image->get_id() . "," . $width . "," . $height . ");");
        $content->setVariable("IMAGE_ACTIONS", $actions);
        $content->parse("BLOCK_IMAGE");
    }
}
$question = gettext("Do you really want to delete this image?");
$note = gettext("NOTE: All wiki-entries containing this image have to be updated manually!");
$content->setVariable("QUESTION", $question);
$content->setVariable("NOTE", $note);
$content->setVariable("LABEL_CLOSE", gettext("close"));
$content->setVariable("BACK_LINK", PATH_URL . "wiki/" . $wiki_container->get_id() . "/");
$content->setVariable("BACK_LABEL", gettext("back"));
$wiki_html_handler->set_main_html($content->get());
// breadcrumbs
$rootlink = lms_steam::get_link_to_root($wiki_container);
WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/" . $wiki_container->get_id() . "/"), array("link" => "", "name" => gettext("Mediathek"))) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/" . $wiki_container->get_id() . "/"), array("link" => "", "name" => gettext("Mediathek"))));
$portal->set_page_main($headline, $wiki_html_handler->get_html());
$portal->show_html();
Пример #4
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $forum_id = $this->params[0];
     $portal = \lms_portal::get_instance();
     $user = \lms_steam::get_current_user();
     $rss_feeds = $user->get_attribute("USER_RSS_FEEDS");
     $author_id = isset($this->params[1]) ? $this->params[1] : null;
     if (!($messageboard = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $forum_id))) {
         include "bad_link.php";
         exit;
     }
     if ($messageboard instanceof \steam_document) {
         $thread = $messageboard;
         $messageboard = $thread->get_annotating();
         define("OBJ_ID", $thread->get_id());
         if (!$thread->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     } else {
         define("OBJ_ID", $messageboard->get_id());
         if (!$messageboard->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     if (!$messageboard instanceof \steam_messageboard) {
         include "bad_link.php";
         exit;
     }
     $is_watching = FALSE;
     if (is_array($rss_feeds)) {
         foreach (array_keys($rss_feeds) as $item) {
             if ($item == $messageboard->get_id()) {
                 $is_watching = TRUE;
             }
         }
     }
     $content = \Messageboard::getInstance()->loadTemplate("forum_all_topics.template.html");
     $dsc = $messageboard->get_attribute("OBJ_DESC");
     if (!empty($dsc)) {
         $content->setCurrentBlock("BLOCK_DESCRIPTION");
         $content->setVariable("FORUM_DESCRIPTION", get_formatted_output($dsc));
         $content->parse("BLOCK_DESCRIPTION");
     }
     $grp = $messageboard->get_environment()->get_creator();
     if ($grp->get_name() == "learners" && $grp->get_attribute(OBJ_TYPE) == "course_learners") {
         $grp = $grp->get_parent_group();
     }
     $content->setVariable("CURRENT_DISCUSSIONS_LABEL", gettext("Current Thread"));
     $content->setVariable("LABEL_SEARCH", gettext("Search"));
     if (isset($_GET["action"]) && $_GET["action"] == "bookmark_rss") {
         \lms_steam::user_add_rssfeed($messageboard->get_id(), PATH_URL . "services/feeds/forum_public.php?id=" . $messageboard->get_id(), "discussion board", \lms_steam::get_link_to_root($messageboard));
         $_SESSION["confirmation"] = str_replace("%NAME", h($messageboard->get_name()), gettext("You are keeping an eye on '%NAME' from now on."));
         header("Location: " . PATH_URL . "forums/" . $messageboard->get_id() . "/");
         exit;
     }
     if (isset($_GET["action"]) && $_GET["action"] == "delete_bookmark") {
         $user = \lms_steam::get_current_user();
         $id = (int) $_GET["unsubscribe"];
         $feeds = $user->get_attribute("USER_RSS_FEEDS");
         if (!is_array($feeds)) {
             $feeds = array();
         }
         unset($feeds[$id]);
         $user->set_attribute("USER_RSS_FEEDS", $feeds);
         $_SESSION["confirmation"] = str_replace("%NAME", h($messageboard->get_name()), gettext("subscription of '%NAME' canceled."));
         header("Location: " . PATH_URL . "forums/" . $messageboard->get_id() . "/");
         exit;
     }
     if (empty($_GET["pattern"]) && !isset($author_id)) {
         $cache = get_cache_function(OBJ_ID, 300);
         $discussions = $cache->call("lms_forum::get_discussions", OBJ_ID);
     } elseif (isset($author_id)) {
         $cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 300);
         $discussions = $cache->call("lms_forum::search_user_posts", $messageboard->get_id(), $author_id);
     } else {
         $cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 300);
         $discussions = $cache->call("lms_forum::search_pattern", $messageboard->get_id(), $_GET["pattern"]);
     }
     $content->setVariable("LABEL_ALL_TOPICS", gettext("All Threads"));
     if ($messageboard->check_access_annotate(\lms_steam::get_current_user())) {
         $content->setCurrentBlock("BLOCK_WRITE_ACCESS");
         if (isset($author_id)) {
             $content->setVariable("LABEL_THREADS_POSTED_IN", gettext("All Threads"));
             // TODO: Passt der link?
             $content->setVariable("LINK_AUTHOR", PATH_URL . "forums/" . $messageboard->get_id() . "/");
         } else {
             $content->setVariable("LABEL_THREADS_POSTED_IN", gettext("Threads you've posted in"));
             // TODO: Passt der link?
             $content->setVariable("LINK_AUTHOR", PATH_URL . "forums/" . $messageboard->get_id() . "/?author=" . \lms_steam::get_current_user()->get_name());
         }
         // TODO: Passt der link?
         $content->setVariable("LINK_POST_NEW", PATH_URL . "messageboard/newDiscussion/" . $messageboard->get_id());
         $content->setVariable("LABEL_POST_NEW_THREAD", gettext("Post a new thread"));
         $content->parse("BLOCK_WRITE_ACCESS");
     }
     if ($messageboard->check_access_write(\lms_steam::get_current_user())) {
         $content->setCurrentBlock("BLOCK_ADMIN");
         $content->setVariable("LINK_EDIT", PATH_URL . "messageboard/editMessageboard/" . $messageboard->get_id());
         $content->setVariable("LABEL_EDIT", gettext("Preferences"));
         $content->setVariable("LINK_DELETE", PATH_URL . "messageboard/deleteMessageboard/" . $messageboard->get_id());
         $content->setVariable("LABEL_DELETE", gettext("Delete forum"));
         $content->parse("BLOCK_ADMIN");
     }
     $content->setCurrentBlock("BLOCK_WATCH");
     if ($is_watching) {
         $content->setVariable("LABEL_BOOKMARK", gettext("End watching"));
         // TODO: Passt der link?
         $content->setVariable("LINK_BOOKMARK", PATH_URL . "forums/" . $messageboard->get_id() . "/?action=delete_bookmark&unsubscribe=" . $messageboard->get_id());
     } else {
         $content->setVariable("LABEL_BOOKMARK", gettext("Watch this forum"));
         // TODO: Passt der link?
         $content->setVariable("LINK_BOOKMARK", PATH_URL . "forums/" . $messageboard->get_id() . "/?action=bookmark_rss");
     }
     $content->parse("BLOCK_WATCH");
     // ACCESS
     $access_descriptions = \lms_forum::get_access_descriptions($grp);
     $access_descriptions = $access_descriptions[$messageboard->get_attribute(KOALA_ACCESS)];
     $access = $access_descriptions["summary_short"] . ": " . $access_descriptions["label"];
     $content->setCurrentBlock("BLOCK_ACCESS");
     $content->setVariable("TITLE_ACCESS", gettext("Access"));
     $content->setVariable("LABEL_ACCESS", $access);
     $content->parse("BLOCK_ACCESS");
     $content->setVariable("LABEL_TITLE", gettext("Title"));
     $content->setVariable("LABEL_AUTHOR", gettext("Author"));
     $content->setVariable("LABEL_REPLIES", gettext("Replies"));
     $content->setVariable("LABEL_LATEST_POST", gettext("Latest Post"));
     // PAGE SETZEN
     $no_discussions = count($discussions);
     $paginator = \lms_portal::get_paginator(20, $no_discussions, gettext("(%TOTAL discussions in forum)"));
     $start = $paginator["startIndex"];
     //$start = $portal->set_paginator( $content, 20, $no_discussions, gettext( "(%TOTAL discussions in forum)" ) );
     $end = $start + 20 > $no_discussions ? $no_discussions : $start + 20;
     for ($i = $start; $i < $end; $i++) {
         $discussion = $discussions[$i];
         $content->setVariable("PAGINATOR", $paginator["html"]);
         $content->setCurrentBlock("BLOCK_THREAD");
         if (time() - $discussion["LATEST_POST_TS"] > $_SESSION["last_login"]) {
             $content->setCurrentBlock("BLOCK_THREAD_NEW");
             $content->setVariable("NEW_LABEL", gettext("New"));
             $content->parse("BLOCK_THREAD_NEW");
         }
         $content->setVariable("THREAD_LINK", PATH_URL . "messageboard/viewDiscussion/" . $discussion["OBJ_ID"] . "/");
         $content->setVariable("THREAD_SUBJECT", h($discussion["OBJ_NAME"]));
         $content->setVariable("THREAD_LAST_ENTRY", how_long_ago($discussion["LATEST_POST_TS"]));
         // TODO: Passt der link?
         $content->setVariable("AUTHOR_LINK", PATH_URL . "user/" . $discussion["AUTHOR_LOGIN"] . "/");
         $content->setVariable("AUTHOR_IMAGE", PATH_URL . "cached/get_document.php?id=" . $discussion["OBJ_ICON"] . "&type=usericon&width=30&height=40");
         $title = !empty($discussion["USER_ACADEMIC_TITLE"]) ? $discussion["USER_ACADEMIC_TITLE"] . " " : "";
         $content->setVariable("AUTHOR_NAME", h($title . $discussion["USER_FIRSTNAME"] . " " . $discussion["USER_FULLNAME"]));
         $content->setVariable("THREAD_REPLIES", h($discussion["REPLIES"]));
         $content->parse("BLOCK_THREAD");
     }
     $portal->set_rss_feed(PATH_URL . "services/feeds/forum_public.php?id=" . OBJ_ID, gettext("Feed"), str_replace("%l", isset($login) ? $login : "", gettext("Subscribe to this forum's Newsfeed")));
     // TODO: Passt der link?
     $rootlink = \lms_steam::get_link_to_root($messageboard);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => "", "name" => h($messageboard->get_name())));
     $frameResponseObject->setTitle("Messageboard");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Пример #5
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $user = \lms_steam::get_current_user();
     // Disable caching
     // TODO: Work on cache handling. An enabled cache leads to bugs
     // if used with the wiki.
     \CacheSettings::disable_caching();
     if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
         include "bad_link.php";
         exit;
     }
     if (!$wiki_container instanceof \steam_container) {
         $wiki_doc = $wiki_container;
         $wiki_container = $wiki_doc->get_environment();
         if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
             include "bad_link.php";
             exit;
         }
     }
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $version_doc = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[1]);
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $problems = "";
         try {
             $new_content = $version_doc->get_content();
             $wiki_doc->set_content($new_content);
         } catch (Exception $ex) {
             $problems = $ex->get_message();
         }
         if (empty($problems)) {
             $_SESSION["confirmation"] = str_replace("%VERSION", $version_doc->get_version(), gettext("Version %VERSION recovered."));
             header("Location: " . PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/");
             exit;
         } else {
             $frameResponseObject->setProblemDescription($problems);
             //$portal->set_problem_description( $problems, $hints );
         }
     }
     $backlink = PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/";
     $content = \Wiki::getInstance()->loadTemplate("wiki_recover_version.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "wiki_recover_version.template.html" );
     $content->setVariable("BACK_LINK", $backlink);
     $content->setVariable("INFO_TEXT", gettext("A new version will be created from the one you are recovering. The actual version will not be lost. Is that what you want?"));
     $content->setVariable("LABEL_OK", gettext("Yes, Recover version"));
     $content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
     $rootlink = \lms_steam::get_link_to_root($wiki_container);
     WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => "", "name" => str_replace("%VERSION", $version_doc->get_version(), gettext("Recover version %VERSION")))) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => "", "name" => str_replace("%VERSION", $version_doc->get_version(), gettext("Recover version %VERSION")))));
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
     /*$portal->set_page_main(
     		$headline,
     		$content->get()
     		);
     		$portal->show_html();
     		*/
 }
Пример #6
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $portal = \lms_portal::get_instance();
     if (!isset($messageboard) || !is_object($messageboard)) {
         if (empty($this->params[0])) {
             throw new \Exception("Environment not set.");
         }
         if (empty($this->params[1])) {
             throw new \Exception("Group not set.");
         }
         if (!($env = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[0]))) {
             throw new \Exception("Environment unknown.");
         }
         if (!($grp = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[1]))) {
             throw new \Exception("Group unknown");
         }
     }
     $accessmergel = FALSE;
     if (isset($messageboard) && is_object($messageboard)) {
         $creator = $messageboard->get_creator();
         if ($messageboard->get_attribute(KOALA_ACCESS) == PERMISSION_UNDEFINED && \lms_steam::get_current_user()->get_id() != $creator->get_id() && !\lms_steam::is_koala_admin(\lms_steam::get_current_user())) {
             $accessmergel = TRUE;
         }
     }
     // TODO: Passt der link?
     $backlink = empty($_POST["values"]["backlink"]) ? $_SERVER["HTTP_REFERER"] : $_POST["values"]["backlink"];
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = $_POST["values"];
         if (get_magic_quotes_gpc()) {
             if (!empty($values['name'])) {
                 $values['name'] = stripslashes($values['name']);
             }
             if (!empty($values['dsc'])) {
                 $values['dsc'] = stripslashes($values['dsc']);
             }
         }
         if (empty($values["name"])) {
             $problems = gettext("The name of new message board is missing.");
             $hints = gettext("Please type in a name.");
         }
         if (strpos($values["name"], "/")) {
             if (!isset($problems)) {
                 $problems = "";
             }
             $problems .= gettext("Please don't use the \"/\"-char in the the forum name.");
         }
         if (empty($problems)) {
             $group_members = $grp;
             $group_admins = 0;
             $group_staff = 0;
             // check if group is a course
             $grouptype = (string) $grp->get_attribute("OBJ_TYPE");
             if ($grouptype == "course") {
                 $group_staff = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".staff");
                 $group_admins = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".admins");
                 $group_members = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".learners");
                 $workroom = $group_members->get_workroom();
             } else {
                 $workroom = $grp->get_workroom();
             }
             if (!isset($messageboard) || !is_object($messageboard)) {
                 $new_forum = \steam_factory::create_messageboard($GLOBALS["STEAM"]->get_id(), $values["name"], $env, $values["dsc"]);
                 $_SESSION["confirmation"] = str_replace("%NAME", h($values["name"]), gettext("New forum '%NAME' created."));
             } else {
                 $messageboard->set_attribute(OBJ_NAME, $values["name"]);
                 $messageboard->set_attribute(OBJ_DESC, $values["dsc"]);
                 $portal->set_confirmation(gettext("The changes have been saved."));
                 $new_forum = $messageboard;
             }
             $koala_forum = new \lms_forum($new_forum);
             $access = (int) $values["access"];
             $access_descriptions = \lms_forum::get_access_descriptions($grp);
             if (!$accessmergel) {
                 $koala_forum->set_access($access, $access_descriptions[$access]["members"], $access_descriptions[$access]["steam"], $group_members, $group_staff, $group_admins);
             }
             $GLOBALS["STEAM"]->buffer_flush();
             $cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 600);
             $cache->drop("lms_steam::get_inventory_recursive", $workroom->get_id(), CLASS_MESSAGEBOARD, array("FORUM_LANGUAGE"));
             $cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
             if (!isset($messageboard) || !is_object($messageboard)) {
                 header("Location: " . $backlink);
                 exit;
             }
         } else {
             $portal->set_problem_description($problems, isset($hints) ? $hints : "");
         }
     }
     $content = \Messageboard::getInstance()->loadTemplate("object_new.template.html");
     if (isset($messageboard) && is_object($messageboard)) {
         $content->setVariable("INFO_TEXT", str_replace("%NAME", h($messageboard->get_name()), gettext("You are going to edit the forum '<b>%NAME</b>'.")));
         $content->setVariable("LABEL_CREATE", gettext("Save changes"));
         $pagetitle = gettext("Preferences");
         if (empty($values)) {
             $values = array();
             $values["name"] = $messageboard->get_name();
             $values["dsc"] = $messageboard->get_attribute(OBJ_DESC);
             $values["access"] = $messageboard->get_attribute(KOALA_ACCESS);
         }
         $breadcrumbheader = gettext("Preferences");
     } else {
         $grpname = $grp->get_attribute(OBJ_NAME);
         if ($grp->get_attribute(OBJ_TYPE) == "course") {
             $grpname = $grp->get_attribute(OBJ_DESC);
         }
         $content->setVariable("INFO_TEXT", str_replace("%ENV", h($grpname), gettext("You are going to create a new forum in '<b>%ENV</b>'.")));
         $content->setVariable("LABEL_CREATE", gettext("Create forum"));
         $pagetitle = gettext("Create forum");
         $breadcrumbheader = gettext("Add new forum");
     }
     if (!empty($values)) {
         if (!empty($values["name"])) {
             $content->setVariable("VALUE_NAME", h($values["name"]));
         }
         if (!empty($values["dsc"])) {
             $content->setVariable("VALUE_DSC", h($values["dsc"]));
         }
     }
     $content->setVariable("VALUE_BACKLINK", $backlink);
     $content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
     $content->setVariable("LABEL_NAME", gettext("Name"));
     $content->setVariable("LABEL_DSC", gettext("Description"));
     $content->setVariable("LABEL_BB_BOLD", gettext("B"));
     $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
     $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
     $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
     $content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
     $content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
     $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
     $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
     $content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
     $content->setVariable("HINT_BB_IMAGE", gettext("image"));
     $content->setVariable("LABEL_BB_URL", gettext("URL"));
     $content->setVariable("HINT_BB_URL", gettext("web link"));
     $content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
     $content->setVariable("HINT_BB_MAIL", gettext("email link"));
     $content->setVariable("LABEL_ACCESS", gettext("Access"));
     if ((string) $grp->get_attribute("OBJ_TYPE") == "course") {
         $access_default = PERMISSION_PUBLIC;
     } else {
         $access_default = PERMISSION_PUBLIC;
     }
     if ($accessmergel) {
         $mailto = "mailto:'.SUPPORT_EMAIL.'?subject=KoaLA:%20Invalid%20Access%20Rights&body=" . rawurlencode("\nLink: " . get_current_URL() . "\nCreator: " . $creator->get_identifier() . "\n");
         $content->setCurrentBlock("BLOCK_ACCESSMERGEL");
         $content->setVariable("LABEL_ACCESSMERGEL", str_replace("%MAILTO", $mailto, gettext("There is a problem with the access settings. Please <a href=\"%MAILTO\">contact the support team</a> to fix it by setting the access rights again.")));
         $content->parse("BLOCK_ACCESSMERGEL");
     } else {
         $access = \lms_forum::get_access_descriptions($grp);
         if (is_array($access)) {
             $content->setCurrentBlock("BLOCK_ACCESS");
             foreach ($access as $key => $array) {
                 if ($key != PERMISSION_UNDEFINED || isset($values) && (int) $values["access"] == PERMISSION_UNDEFINED) {
                     $content->setCurrentBlock("ACCESS");
                     $content->setVariable("LABEL", $array["summary_short"] . ": " . $array["label"]);
                     $content->setVariable("VALUE", $key);
                     if (isset($values) && $key == (int) $values["access"] || empty($values) && $key == $access_default) {
                         $content->setVariable("CHECK", "checked=\"checked\"");
                     }
                     $content->parse("ACCESS");
                 }
             }
             $content->parse("BLOCK_ACCESS");
         }
     }
     // TODO: Passt der link?
     $rootlink = \lms_steam::get_link_to_root($grp);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")));
     if (isset($messageboard) && is_object($messageboard)) {
         $headline[] = array("link" => PATH_URL . "forums/" . $messageboard->get_id() . "/", "name" => $messageboard->get_name());
     }
     $headline[] = array("link" => "", "name" => $breadcrumbheader);
     $frameResponseObject->setTitle("Messageboard");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Пример #7
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //CODE FOR ALL COMMANDS OF THIS PACKAGE START
     $user = \lms_steam::get_current_user();
     // Disable caching
     // TODO: Work on cache handling. An enabled cache leads to bugs
     // if used with the wiki.
     \CacheSettings::disable_caching();
     if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
         include "bad_link.php";
         exit;
     }
     if (!$wiki_container instanceof \steam_container) {
         $wiki_doc = $wiki_container;
         $wiki_container = $wiki_doc->get_environment();
         if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
             include "bad_link.php";
             exit;
         }
     }
     //CODE FOR ALL COMMANDS OF THIS PACKAGE END
     $env = $wiki_container->get_environment();
     $grp = $env->get_creator();
     if ($grp->get_name() == "learners" && $grp->get_attribute(OBJ_TYPE) == "course_learners") {
         $grp = $grp->get_parent_group();
     }
     if (!isset($wiki_container) || !is_object($wiki_container)) {
         if (!($env = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_GET["env"]))) {
             throw new Exception("Environment unknown.");
         }
         if (!($grp = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_GET["group"]))) {
             throw new Exception("Group unknown");
         }
     }
     $accessmergel = FALSE;
     if (isset($wiki_container) && is_object($wiki_container)) {
         $creator = $wiki_container->get_creator();
         if ($wiki_container->get_attribute(KOALA_ACCESS) == PERMISSION_UNDEFINED && \lms_steam::get_current_user()->get_id() != $creator->get_id() && !\lms_steam::is_koala_admin(\lms_steam::get_current_user())) {
             $accessmergel = TRUE;
         }
     }
     $backlink = empty($_POST["values"]["backlink"]) ? $_SERVER["HTTP_REFERER"] : $_POST["values"]["backlink"];
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = $_POST["values"];
         if (get_magic_quotes_gpc()) {
             if (!empty($values['name'])) {
                 $values['name'] = stripslashes($values['name']);
             }
             if (!empty($values['dsc'])) {
                 $values['dsc'] = stripslashes($values['dsc']);
             }
         }
         if (empty($values["name"])) {
             $problems = gettext("The name of new wiki is missing.");
             $hints = gettext("Please type in a name.");
         }
         if (strpos($values["name"], "/")) {
             if (!isset($problems)) {
                 $problems = "";
             }
             $problems .= gettext("Please don't use the \"/\"-char in the name of the wiki.");
         }
         if (empty($problems)) {
             $group_members = $grp;
             $group_admins = 0;
             $group_staff = 0;
             // check if group is a course
             $grouptype = (string) $grp->get_attribute("OBJ_TYPE");
             if ($grouptype == "course") {
                 $group_staff = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".staff");
                 $group_admins = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".admins");
                 $group_members = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".learners");
                 $workroom = $group_members->get_workroom();
             } else {
                 $workroom = $grp->get_workroom();
             }
             if (!isset($wiki_container) || !is_object($wiki_container)) {
                 $new_wiki = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $values["name"], $env, $values["dsc"]);
                 $new_wiki->set_attribute("OBJ_TYPE", "container_wiki_koala");
                 $_SESSION["confirmation"] = str_replace("%NAME", $values["name"], gettext("New wiki '%NAME' created."));
             } else {
                 $wiki_container->set_attribute(OBJ_NAME, $values["name"]);
                 if ($values["wiki_startpage"] == gettext("Glossary")) {
                     $values["wiki_startpage"] = "glossary";
                 }
                 $wiki_container->set_attribute("OBJ_WIKI_STARTPAGE", $values["wiki_startpage"]);
                 $wiki_container->set_attribute(OBJ_DESC, $values["dsc"]);
                 //$portal->set_confirmation(gettext( "The changes have been saved." ));
                 $new_wiki = $wiki_container;
             }
             $koala_wiki = new \lms_wiki($new_wiki);
             $access = (int) $values["access"];
             $access_descriptions = \lms_wiki::get_access_descriptions($grp);
             if (!$accessmergel) {
                 $koala_wiki->set_access($access, $access_descriptions[$access]["members"], $access_descriptions[$access]["steam"], $group_members, $group_staff, $group_admins);
             }
             $GLOBALS["STEAM"]->buffer_flush();
             $cache = get_cache_function(\lms_steam::get_current_user()->get_name());
             $cache->drop("lms_steam::get_inventory_recursive", $workroom->get_id(), CLASS_CONTAINER, array("OBJ_TYPE", "WIKI_LANGUAGE"));
             $cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
             if (!isset($wiki_container) || !is_object($wiki_container)) {
                 header("Location: " . $backlink);
                 exit;
             }
         } else {
             $frameResponseObject->setProblemDescription($problems);
             $frameResponseObject->setProblemSolution(isset($hints) ? $hints : "");
         }
     }
     $content = \Wiki::getInstance()->loadTemplate("object_new.template.html");
     //$content = new HTML_TEMPLATE_IT( PATH_TEMPLATES );
     //$content->loadTemplateFile( "object_new.template.html" );
     if (isset($wiki_container) && is_object($wiki_container)) {
         $content->setVariable("INFO_TEXT", str_replace("%NAME", h($wiki_container->get_name()), gettext("You are going to edit the wiki '<b>%NAME</b>'.")));
         $content->setVariable("LABEL_CREATE", gettext("Save changes"));
         $pagetitle = gettext("Preferences");
         if (empty($values)) {
             $values = array();
             $values["name"] = $wiki_container->get_name();
             $values["dsc"] = $wiki_container->get_attribute(OBJ_DESC);
             $values["wiki_startpage"] = $wiki_container->get_attribute("OBJ_WIKI_STARTPAGE");
             $values["access"] = $wiki_container->get_attribute(KOALA_ACCESS);
         }
         $breadcrumbheader = gettext("Preferences");
         $content->setVariable("OPTION_WIKI_GLOSSARY", gettext("Glossary"));
         $wiki_entries = $wiki_container->get_inventory(CLASS_DOCUMENT);
         $wiki_entries_sorted = array();
         foreach ($wiki_entries as $wiki_entry) {
             if ($wiki_entry->get_attribute(DOC_MIME_TYPE) === "text/wiki") {
                 $wiki_entries_sorted[] = str_replace(".wiki", "", $wiki_entry->get_name());
             }
         }
         sort($wiki_entries_sorted);
         $startpageFound = false;
         foreach ($wiki_entries_sorted as $wiki_entry) {
             $content->setCurrentBlock("BLOCK_WIKI_STARTPAGE_OPTION");
             $content->setVariable("OPTION_WIKI_STARTPAGE", $wiki_entry);
             if ($values["wiki_startpage"] == $wiki_entry) {
                 $content->setVariable("WIKI_STARTPAGE_SELECTED", "selected");
                 $startpageFound = true;
             }
             $content->parse("BLOCK_WIKI_STARTPAGE_OPTION");
         }
         if (!$startpageFound) {
             $content->setVariable("OPTION_WIKI_GLOSSARY_SELECTED", "selected");
         }
     } else {
         $grpname = $grp->get_attribute(OBJ_NAME);
         if ($grp->get_attribute(OBJ_TYPE) == "course") {
             $grpname = $grp->get_attribute(OBJ_DESC);
         }
         $content->setVariable("OPTION_WIKI_GLOSSARY", gettext("Glossary"));
         $content->setVariable("OPTION_WIKI_GLOSSARY_SELECTED", "selected");
         $content->setVariable("INFO_TEXT", str_replace("%ENV", h($grpname), gettext("You are going to create a new wiki in '<b>%ENV</b>'.")));
         $content->setVariable("LABEL_CREATE", gettext("Create wiki"));
         $pagetitle = gettext("Create wiki");
         $breadcrumbheader = gettext("Add new wiki");
     }
     if (!empty($values)) {
         if (!empty($values["name"])) {
             $content->setVariable("VALUE_NAME", h($values["name"]));
         }
         if (!empty($values["dsc"])) {
             $content->setVariable("VALUE_DSC", h($values["dsc"]));
         }
         if (!empty($values["wiki_startpage"])) {
             $content->setVariable("VALUE_WIKI_STARTPAGE", h($values["wiki_startpage"]));
         }
     }
     $content->setVariable("VALUE_BACKLINK", $backlink);
     $content->setVariable("LABEL_NAME", gettext("Name"));
     $content->setVariable("LABEL_DSC", gettext("Description"));
     $content->setVariable("LABEL_WIKI_STARTPAGE", gettext("Startpage"));
     $content->setVariable("LABEL_ACCESS", gettext("Access"));
     $content->setVariable("LABEL_BB_BOLD", gettext("B"));
     $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
     $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
     $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
     $content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
     $content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
     $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
     $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
     $content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
     $content->setVariable("HINT_BB_IMAGE", gettext("image"));
     $content->setVariable("LABEL_BB_URL", gettext("URL"));
     $content->setVariable("HINT_BB_URL", gettext("web link"));
     $content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
     $content->setVariable("HINT_BB_MAIL", gettext("email link"));
     if ($accessmergel) {
         $mailto = "mailto:'.SUPPORT_EMAIL.'?subject=KoaLA:%20Invalid%20Access%20Rights&body=" . rawurlencode("\nLink: " . get_current_URL() . "\nCreator: " . $creator->get_identifier() . "\n");
         $content->setCurrentBlock("BLOCK_ACCESSMERGEL");
         $content->setVariable("LABEL_ACCESSMERGEL", str_replace("%MAILTO", $mailto, gettext("There is a problem with the access settings. Please <a href=\"%MAILTO\">contact the support team</a> to fix it by setting the access rights again.")));
         $content->parse("BLOCK_ACCESSMERGEL");
     } else {
         $access = \lms_wiki::get_access_descriptions($grp);
         if ((string) $grp->get_attribute("OBJ_TYPE") == "course") {
             $access_default = PERMISSION_PUBLIC;
         } else {
             $access_default = PERMISSION_PUBLIC_READONLY;
             if (isset($wiki_container) && is_object($wiki_container) && $creator->get_id() != \lms_steam::get_current_user()->get_id()) {
                 $access[PERMISSION_PRIVATE_READONLY] = str_replace("%NAME", $creator->get_name(), $access[PERMISSION_PRIVATE_READONLY]);
             } else {
                 $access[PERMISSION_PRIVATE_READONLY] = str_replace("%NAME", "you", $access[PERMISSION_PRIVATE_READONLY]);
             }
         }
         if (is_array($access)) {
             $content->setCurrentBlock("BLOCK_ACCESS");
             foreach ($access as $key => $array) {
                 if ($key != PERMISSION_UNDEFINED || isset($values) && (int) $values["access"] == PERMISSION_UNDEFINED) {
                     $content->setCurrentBlock("ACCESS");
                     $content->setVariable("LABEL", $array["summary_short"] . ": " . $array["label"]);
                     $content->setVariable("VALUE", $key);
                     if (isset($values) && $key == (int) $values["access"] || empty($values) && $key == $access_default) {
                         $content->setVariable("CHECK", "checked=\"checked\"");
                     }
                     $content->parse("ACCESS");
                 }
             }
             $content->parse("BLOCK_ACCESS");
         }
     }
     $content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
     $rootlink = \lms_steam::get_link_to_root($grp);
     WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication"))) : "";
     if (isset($wiki_container) && is_object($wiki_container)) {
         $headline[] = array("link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/", "name" => h($wiki_container->get_name()));
     }
     $headline[] = array("link" => "", "name" => $breadcrumbheader);
     $frameResponseObject->setTitle($pagetitle);
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
     /*$portal->set_page_main( $headline, $content->get() );
     	 $portal->set_page_title( $pagetitle );
     	 $portal->show_html();*/
 }
Пример #8
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     $timestamp = $this->params[1];
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //$path = $request->getPath();
     $STEAM = $GLOBALS["STEAM"];
     $weblogId = $this->params[0];
     $weblog = \steam_factory::get_object($STEAM->get_id(), $weblogId);
     //if ( ! $weblog = steam_factory::get_object( $STEAM->get_id(), $_GET[ "id" ] ) )
     //{
     //	include( "bad_link.php" );
     //	exit;
     //}
     if (!$weblog instanceof \steam_calendar) {
         if ($weblog instanceof \steam_container) {
             $category = $weblog;
             $categories = $category->get_environment();
             $weblog = new \steam_weblog($GLOBALS["STEAM"], $categories->get_environment()->get_id());
         } elseif ($weblog instanceof \steam_date) {
             $date = $weblog;
             $weblog = new \steam_weblog($GLOBALS["STEAM"], $date->get_environment()->get_id());
         } else {
             include "bad_link.php";
             exit;
         }
     } else {
         $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $weblogId);
         define("OBJ_ID", $weblogId);
         if (!$weblog->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     $weblog_html_handler = new \lms_weblog($weblog);
     $weblog_html_handler->set_widget_categories();
     $weblog_html_handler->set_widget_archive();
     $first_of_month = $timestamp;
     $last_of_month = strtotime("-1 day", strtotime("+1 month", $first_of_month));
     $date_objects = $weblog->get_date_objects((int) $first_of_month, (int) $last_of_month);
     // $date_objects = $weblog->get_date_objects( );
     $no_entries = count($date_objects);
     //TODO: PAGINATOR REINKNALLEN
     $pageIterator = \lms_portal::get_paginator(5, $no_entries, gettext("%TOTAL entries in this archive."));
     //$content->setVariable("PAGEITERATOR", $pageIterator["html"]);
     $start = $pageIterator["startIndex"];
     //$start = $portal->set_paginator( 5, $no_entries, gettext( "%TOTAL entries in this archive." ) );
     $end = $start + 5 > $no_entries ? $no_entries : $start + 5;
     $weblog_html_handler->print_entries($date_objects, TRUE);
     //$portal->set_rss_feed( PATH_URL . "services/feeds/weblog_public.php?id=" . OBJ_ID , gettext( "Feed" ), str_replace( "%l", (isset($login))?$login:'', gettext( "Subscribe to this forum's Newsfeed" ) ) );
     $rootlink = \lms_steam::get_link_to_root($weblog);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($weblog->get_name()), "link" => PATH_URL . "weblog/" . $weblog->get_id() . "/"), array("link" => "", "name" => strftime("%B %G", $timestamp)));
     //$portal->set_page_main(
     //	$headline,
     //	$weblog_html_handler->get_html()
     //);
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($weblog_html_handler->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Пример #9
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $forum_id = $this->params[0];
     $comment_id = $this->params[1];
     $portal = \lms_portal::get_instance();
     $user = \lms_steam::get_current_user();
     $rss_feeds = $user->get_attribute("USER_RSS_FEEDS");
     if (!($messageboard = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $forum_id))) {
         include "bad_link.php";
         exit;
     }
     if ($messageboard instanceof \steam_document) {
         $thread = $messageboard;
         $messageboard = $thread->get_annotating();
         define("OBJ_ID", $thread->get_id());
         if (!$thread->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     } else {
         define("OBJ_ID", $messageboard->get_id());
         if (!$messageboard->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     if (!$messageboard instanceof \steam_messageboard) {
         include "bad_link.php";
         exit;
     }
     $is_watching = FALSE;
     if (is_array($rss_feeds)) {
         foreach (array_keys($rss_feeds) as $item) {
             if ($item == $messageboard->get_id()) {
                 $is_watching = TRUE;
             }
         }
     }
     // no direct call
     /* TODO: Soll das rein?
     		if (!defined('_VALID_KOALA')) {
     			header("location:/");
     			exit;
     		}
     		*/
     $comment = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $comment_id);
     $user = \lms_steam::get_current_user();
     if ($_SERVER["REQUEST_METHOD"] == "POST" && $comment->check_access_write($user)) {
         $values = $_POST["values"];
         if ($values["delete"]) {
             $_SESSION["confirmation"] = str_replace("%NAME", h($comment->get_name()), gettext("The comment '%NAME' has been deleted."));
             $annotating = $comment->get_annotating();
             $annotating->remove_annotation($comment);
             \lms_steam::delete($comment);
             require_once "Cache/Lite.php";
             $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
             $cache = get_cache_function(OBJ_ID, 600);
             $cache->drop("lms_steam::get_annotations", OBJ_ID);
             // Handle Related Cache-Data
             require_once "Cache/Lite.php";
             $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
             $cache->clean(OBJ_ID);
             // clean forumcache
             $fcache = get_cache_function(OBJ_ID, 600);
             $fcache->drop("lms_forum::get_discussions", OBJ_ID);
             // clean cache for Weblog RSS Feed for the Comments
             $fcache->drop("lms_steam::get_annotations", OBJ_ID);
             // clean rsscache
             $rcache = get_cache_function("rss", 600);
             // TODO: Passt der link?
             $feedlink = PATH_URL . "services/feeds/forum_public.php?id=" . OBJ_ID;
             $rcache->drop("lms_rss::get_items", $feedlink);
             // TODO: Passt der link?
             $feedlink = PATH_URL . "services/feeds/weblog_public.php?id=" . OBJ_ID;
             $rcache->drop("lms_rss::get_items", $feedlink);
             header("Location: " . PATH_URL . "messageboard/viewDiscussion/" . $forum_id);
             exit;
         }
     }
     $content = \Messageboard::getInstance()->loadTemplate("comment_delete.template.html");
     if ($comment->check_access_write($user)) {
         $content->setVariable("LABEL_ARE_YOU_SURE", gettext("Are you sure you want to delete this comment?"));
         if (isset($document)) {
             // TODO: Passt der link?
             $content->setVariable("DELETE_BACK_LINK", PATH_URL . "doc/" . OBJ_ID . "/");
         } else {
             if (isset($weblog)) {
                 // TODO: Passt der link?
                 $content->setVariable("DELETE_BACK_LINK", PATH_URL . "weblog/" . OBJ_ID . "/");
             } else {
                 // TODO: Passt der link?
                 $content->setVariable("DELETE_BACK_LINK", PATH_URL . "forums/" . OBJ_ID . "/");
             }
         }
         $content->setCurrentBlock("BLOCK_DELETE");
         $content->setVariable("FORM_ACTION", $_SERVER["REQUEST_URI"]);
         $content->setVariable("LABEL_DELETE_IT", gettext("yes, delete it"));
         $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
         $content->setVariable("LABEL_RETURN", gettext("back"));
         $content->parse("BLOCK_DELETE");
     } else {
         $content->setVariable("LABEL_ARE_YOU_SURE", gettext("You have no rights to delete this comment!"));
     }
     $content->setVariable("TEXT_COMMENT", get_formatted_output($comment->get_content()));
     $creator = $comment->get_creator();
     $creator_data = $creator->get_attributes(array("USER_FULLNAME", "USER_FIRSTNAME", "OBJ_ICON"));
     $content->setVariable("LABEL_FROM_AND_AGO", str_replace("%N", "<a href=\"" . PATH_URL . "/user/" . $creator->get_name() . "/\">" . h($creator_data["USER_FIRSTNAME"]) . " " . h($creator_data["USER_FULLNAME"]) . "</a>", gettext("by %N")) . "," . how_long_ago($comment->get_attribute("OBJ_CREATION_TIME")));
     $icon = $creator_data["OBJ_ICON"];
     if ($icon instanceof \steam_object) {
         $icon_id = $icon->get_id();
     } else {
         $icon_id = 0;
     }
     $content->setVariable("ICON_SRC", PATH_URL . "get_document.php?id=" . $icon_id);
     // TODO: Passt der link?
     $rootlink = \lms_steam::get_link_to_root($messageboard);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => PATH_URL . "forums/" . $messageboard->get_id() . "/", "name" => $messageboard->get_name()), array("link" => "", "name" => gettext("Delete comment")));
     $frameResponseObject->setTitle("Messageboard");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Пример #10
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //$path = $request->getPath();
     $STEAM = $GLOBALS["STEAM"];
     $weblogId = $this->id;
     $weblog = \steam_factory::get_object($STEAM->get_id(), $weblogId);
     //if ( ! $weblog = steam_factory::get_object( $STEAM->get_id(), $_GET[ "id" ] ) )
     //{
     //	include( "bad_link.php" );
     //	exit;
     //}
     if (!$weblog instanceof \steam_calendar) {
         if ($weblog instanceof \steam_container) {
             $category = $weblog;
             $categories = $category->get_environment();
             $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $categories->get_environment()->get_id());
         } elseif ($weblog instanceof \steam_date) {
             $date = $weblog;
             $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $date->get_environment()->get_id());
         } else {
             include "bad_link.php";
             exit;
         }
     } else {
         $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $weblogId);
         define("OBJ_ID", $weblogId);
         if (!$weblog->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     if (!isset($date)) {
         throw new \Exception("variable date is not set.");
     }
     //$date = $weblog;
     if ($_SERVER["REQUEST_METHOD"] == "POST" && $date->check_access_write($user)) {
         $values = $_POST["values"];
         if ($values["delete"]) {
             require_once "Cache/Lite.php";
             $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
             $cache->clean($weblog->get_id());
             $cache->clean($date->get_id());
             $trashbin = $GLOBALS["STEAM"]->get_current_steam_user();
             if (is_object($trashbin)) {
                 $date->move($trashbin);
             } else {
                 $date->delete();
             }
         }
         header("Location: " . $values["return_to"]);
         exit;
     }
     $content = \Weblog::getInstance()->loadTemplate("weblog_entry_delete.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "weblog_entry_delete.template.html" );
     $content->setVariable("LABEL_ARE_YOU_SURE", gettext("Are you sure you want to delete this entry?"));
     $content->setVariable("TEXT_COMMENT", get_formatted_output($date->get_attribute("DATE_DESCRIPTION")));
     $creator = $date->get_creator();
     $creator_data = $creator->get_attributes(array("USER_FULLNAME", "USER_FIRSTNAME", "OBJ_ICON"));
     $content->setVariable("LABEL_FROM_AND_AGO", str_replace("%N", "<a href=\"" . PATH_URL . "/user/index/" . $creator->get_name() . "/\">" . h($creator_data["USER_FIRSTNAME"]) . " " . h($creator_data["USER_FULLNAME"]) . "</a>", gettext("by %N")) . "," . how_long_ago($date->get_attribute("OBJ_CREATION_TIME")));
     $content->setVariable("LABEL_DELETE_IT", gettext("yes, delete it"));
     $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
     $content->setVariable("LABEL_RETURN", gettext("back"));
     $content->setVariable("ICON_SRC", PATH_URL . "get_document.php?id=" . $creator_data["OBJ_ICON"]->get_id());
     $rootlink = \lms_steam::get_link_to_root($weblog);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => "", "name" => h($weblog->get_name()), "link" => PATH_URL . "weblog/index/" . $weblog->get_id() . "/"), array("name" => str_replace("%NAME", h($date->get_attribute("DATE_TITLE")), gettext("Delete '%NAME'?"))));
     /*$portal->set_page_main(
     	 $headline,
     	 $content->get(),
     	 ""
     	 );
     	 return $portal->get_html();*/
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Пример #11
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $forum_id = $this->params[0];
     $portal = \lms_portal::get_instance();
     $user = \lms_steam::get_current_user();
     $rss_feeds = $user->get_attribute("USER_RSS_FEEDS");
     if (!($messageboard = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $forum_id))) {
         include "bad_link.php";
         exit;
     }
     if ($messageboard instanceof \steam_document) {
         $thread = $messageboard;
         $messageboard = $thread->get_annotating();
         define("OBJ_ID", $thread->get_id());
         if (!$thread->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     } else {
         define("OBJ_ID", $messageboard->get_id());
         if (!$messageboard->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     if (!$messageboard instanceof \steam_messageboard) {
         include "bad_link.php";
         exit;
     }
     $is_watching = FALSE;
     if (is_array($rss_feeds)) {
         foreach (array_keys($rss_feeds) as $item) {
             if ($item == $messageboard->get_id()) {
                 $is_watching = TRUE;
             }
         }
     }
     $content = \Messageboard::getInstance()->loadTemplate("forum_discussion.template.html");
     $content->setVariable("REPLY_LABEL", gettext("Reply to this topic?"));
     if ($_SERVER["REQUEST_METHOD"] == "POST" && $thread->check_access_annotate(\lms_steam::get_current_user())) {
         $values = $_POST["values"];
         if (empty($values["body"])) {
             $portal->set_problem_description(gettext("Please enter your message."));
         }
         if (!empty($values["save"]) && !empty($values["body"])) {
             $new_comment = \steam_factory::create_textdoc($GLOBALS["STEAM"]->get_id(), "Re: " . $thread->get_name(), $values["body"]);
             //		$all_user = steam_factory::groupname_to_object( $GLOBALS[ "STEAM" ]->get_id(), STEAM_ALL_USER );
             //		$new_comment->set_acquire( FALSE );
             //		$new_comment->set_read_access( $all_user, TRUE );
             //		$new_comment->set_write_access( $all_user, FALSE );
             //		$new_comment->set_annotate_access( $all_user, TRUE );
             $thread->add_annotation($new_comment);
             $new_comment->set_acquire($thread);
             $mbid = $messageboard->get_id();
             // Handle Related Cache-Data
             require_once "Cache/Lite.php";
             $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
             $cache->clean($mbid);
             // clean forumcache
             $fcache = get_cache_function($forum_id, 600);
             $fcache->drop("lms_forum::get_discussions", $forum_id);
             // clean forumcache
             $fcache = get_cache_function($mbid, 600);
             $fcache->drop("lms_forum::get_discussions", $mbid);
             // clean rsscache of the forum
             // TODO: Passt der link?
             $feedlink = PATH_URL . "services/feeds/forum_public.php?id=" . OBJ_ID;
             $rcache = get_cache_function("rss", 600);
             $rcache->drop("lms_rss::get_items", $feedlink);
         } else {
             if (empty($values["save"]) && !empty($values["body"])) {
                 // PREVIEW
                 $content->setCurrentBlock("BLOCK_PREVIEW_COMMENT");
                 $content->setVariable("LABEL_PREVIEW_COMMENT", gettext("Preview the edit"));
                 $content->setVariable("VALUE_PREVIEW_COMMENT", get_formatted_output($values["body"]));
                 $content->setVariable("TEXT_COMMENT", h($values["body"]));
                 $content->parse("BLOCK_PREVIEW_COMMENT");
                 $content->setVariable("REPLY_LABEL", gettext("Change it?"));
             }
         }
     }
     if (isset($_GET["action"]) && $_GET["action"] == "bookmark_rss") {
         \lms_steam::user_add_rssfeed($messageboard->get_id(), PATH_URL . "services/feeds/forum_public.php?id=" . $messageboard->get_id(), "discussion board", \lms_steam::get_link_to_root($messageboard));
         $_SESSION["confirmation"] = str_replace("%NAME", h($messageboard->get_name()), gettext("You are keeping an eye on '%NAME' from now on."));
         header("Location: " . PATH_URL . "forums/" . $thread->get_id() . "/");
         exit;
     }
     if (isset($_GET["action"]) && $_GET["action"] == "delete_bookmark") {
         $user = \lms_steam::get_current_user();
         $id = (int) $_GET["unsubscribe"];
         $feeds = $user->get_attribute("USER_RSS_FEEDS");
         if (!is_array($feeds)) {
             $feeds = array();
         }
         unset($feeds[$id]);
         $user->set_attribute("USER_RSS_FEEDS", $feeds);
         $_SESSION["confirmation"] = str_replace("%NAME", h($messageboard->get_name()), gettext("subscription of '%NAME' canceled."));
         header("Location: " . PATH_URL . "forums/" . $thread->get_id() . "/");
         exit;
     }
     $content->setVariable("CURRENT_DISCUSSIONS_LABEL", gettext("Current Thread"));
     $cache = get_cache_function($messageboard->get_id(), 600);
     $discussions = $cache->call("lms_forum::get_discussions", $messageboard->get_id());
     $max_discussions = 12;
     foreach ($discussions as $discussion) {
         $max_discussions--;
         if ($max_discussions == 0) {
             $content->setCurrentBlock("BLOCK_TOPIC_INFO");
             $content->setVariable("TOPIC_LINK", PATH_URL . "forums/" . $messageboard->get_id() . "/");
             $content->setVariable("TOPIC_TITLE", gettext("More..."));
             $content->parse("BLOCK_TOPIC_INFO");
             break;
         }
         $content->setCurrentBlock("BLOCK_TOPIC_INFO");
         if (time() - $discussion["LATEST_POST_TS"] > $_SESSION["last_login"]) {
             $content->setCurrentBlock("BLOCK_TOPIC_NEW");
             $content->setVariable("NEW_LABEL", gettext("New"));
             $content->parse("BLOCK_TOPIC_NEW");
         }
         $content->setVariable("TOPIC_LINK", PATH_URL . "messageboard/viewDiscussion/" . $discussion["OBJ_ID"] . "/");
         $content->setVariable("TOPIC_TITLE", h($discussion["OBJ_NAME"]));
         $content->setVariable("TOPIC_LAST_ENTRY", gettext("Latest:") . how_long_ago($discussion["LATEST_POST_TS"]));
         $content->parse("BLOCK_TOPIC_INFO");
     }
     $content->setVariable("LABEL_TOPICS_POSTED", gettext("Topics you've posted in"));
     $content->setVariable("LINK_AUTHOR", PATH_URL . "forums/" . $messageboard->get_id() . "/?author=" . \lms_steam::get_current_user()->get_name());
     $content->setVariable("LABEL_POST_NEW", gettext("Post a new topic"));
     $content->setVariable("LINK_POST_NEW", PATH_URL . "messageboard/newDiscussion/" . $messageboard->get_id());
     $content->setCurrentBlock("BLOCK_WATCH");
     if ($is_watching) {
         $content->setVariable("LABEL_BOOKMARK", gettext("End watching"));
         $content->setVariable("LINK_BOOKMARK", PATH_URL . "forums/" . $thread->get_id() . "/?action=delete_bookmark&unsubscribe=" . $messageboard->get_id());
     } else {
         $content->setVariable("LABEL_BOOKMARK", gettext("Watch this forum"));
         $content->setVariable("LINK_BOOKMARK", PATH_URL . "forums/" . $thread->get_id() . "/?action=bookmark_rss");
     }
     $content->parse("BLOCK_WATCH");
     $content->setVariable("DISCUSSION_SUBJECT", h($thread->get_name()));
     $author = $thread->get_creator();
     $author_data = $author->get_attributes(array("OBJ_NAME", "USER_FIRSTNAME", "USER_FULLNAME", "OBJ_ICON"));
     $content->setVariable("AUTHOR_LINK", PATH_URL . "user/" . $author_data["OBJ_NAME"] . "/");
     $icon = $author_data["OBJ_ICON"];
     if ($icon instanceof \steam_object) {
         $icon_id = $icon->get_id();
     } else {
         $icon_id = 0;
     }
     $content->setVariable("AUTHOR_IMAGE", PATH_URL . "cached/get_document.php?id=" . $icon_id . "&type=usericon&width=60&height=70");
     $content->setVariable("NAME_SAYS_LABEL", str_replace("%n", "<a href=\"" . PATH_URL . "user/" . $author_data["OBJ_NAME"] . "/\">" . h($author_data["USER_FIRSTNAME"]) . " " . h($author_data["USER_FULLNAME"]) . "</a>", gettext("%n says:")));
     $content->setVariable("DISCUSSION_TEXT", get_formatted_output($thread->get_content(), 65, "\n"));
     $ts = $thread->get_attribute("OBJ_CREATION_TIME");
     $content->setVariable("DISCUSSION_STARTED_TS", gettext("Posted at") . " " . strftime("%H:%M", $ts) . " | " . strftime("%d. %B %Y", $ts));
     $content->setVariable("DISCUSSION_PERMALINK", PATH_URL . 'forums/' . $discussion['OBJ_ID'] . '/');
     $content->setVariable("DISCUSSION_PERMALINK_TEXT", gettext("permalink"));
     $steam_user = \lms_steam::get_current_user();
     if ($thread->check_access_write($steam_user)) {
         $content->setCurrentBlock("BLOCK_OWN_DISCUSSION");
         $content->setVariable("DISCUSSION_LINK_DELETE", PATH_URL . "messageboard/deleteComment/" . $messageboard->get_id() . "/" . $thread->get_id());
         $content->setVariable("DISCUSSION_LABEL_DELETE", gettext("delete"));
         $content->setVariable("DISCUSSION_LINK_EDIT", PATH_URL . "messageboard/editComment/" . $thread->get_id() . "/" . $thread->get_id());
         $content->setVariable("DISCUSSION_LABEL_EDIT", gettext("edit"));
         $content->parse("BLOCK_OWN_DISCUSSION");
     }
     $annotations = \lms_steam::get_annotations($thread->get_id());
     $annotations = array_reverse($annotations);
     $access_tnr = array();
     foreach ($annotations as $annotation) {
         $steam_obj = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $annotation["OBJ_ID"], CLASS_OBJECT);
         $access_tnr[$steam_obj->get_id()] = $steam_obj->check_access_write($steam_user, TRUE);
     }
     $access_result = $GLOBALS["STEAM"]->buffer_flush();
     foreach ($annotations as $annotation) {
         $content->setCurrentBlock("REPLY");
         $content->setVariable('REPLY_ID', $annotation['OBJ_ID']);
         $content->setVariable("REPLYER_LINK", PATH_URL . "user/" . $annotation["OBJ_CREATOR_LOGIN"] . "/");
         $content->setVariable("REPLYER_IMAGE", PATH_URL . "cached/get_document.php?id=" . $annotation["OBJ_ICON"] . "&type=usericon&width=60&height=70");
         $content->setVariable("REPLYER_SAYS_LABEL", str_replace("%n", "<a href=\"" . PATH_URL . "user/" . $annotation["OBJ_CREATOR_LOGIN"] . "/\">" . h($annotation["OBJ_CREATOR"]) . "</a>", gettext("%n says:")));
         //$content->setVariable( "REPLYERS_SAYS_LABEL", str_replace );
         $content->setVariable("REPLY_CONTENT", get_formatted_output($annotation["CONTENT"], 60, "\n"));
         $content->setVariable("REPLY_TS", how_long_ago($annotation["OBJ_CREATION_TIME"]));
         $content->setVariable("REPLY_PERMALINK", PATH_URL . 'forums/' . $thread->get_id() . '/#comment' . $annotation['OBJ_ID']);
         $content->setVariable("REPLY_PERMALINK_TEXT", gettext("permalink"));
         $steam_obj = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $annotation["OBJ_ID"], CLASS_OBJECT);
         if ($access_result[$access_tnr[$steam_obj->get_id()]]) {
             $content->setCurrentBlock("BLOCK_OWN_REPLY");
             $content->setVariable("REPLY_LINK_DELETE", PATH_URL . "messageboard/deleteComment/" . $thread->get_id() . "/" . $annotation["OBJ_ID"] . "/");
             $content->setVariable("REPLY_LABEL_DELETE", gettext("delete"));
             $content->setVariable("REPLY_LABEL_EDIT", gettext("edit"));
             $content->setVariable("REPLY_LINK_EDIT", PATH_URL . "messageboard/editComment/" . $thread->get_id() . "/" . $annotation["OBJ_ID"] . "/");
             $content->parse("BLOCK_OWN_REPLY");
         }
         $content->parse("REPLY");
     }
     $content->setVariable("LABEL_BB_BOLD", gettext("B"));
     $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
     $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
     $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
     $content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
     $content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
     $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
     $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
     $content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
     $content->setVariable("HINT_BB_IMAGE", gettext("image"));
     $content->setVariable("LABEL_BB_URL", gettext("URL"));
     $content->setVariable("HINT_BB_URL", gettext("web link"));
     $content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
     $content->setVariable("HINT_BB_MAIL", gettext("email link"));
     $content->setVariable("LABEL_PREVIEW", gettext("Preview"));
     $content->setVariable("LABEL_OR", gettext("or"));
     $content->setVariable("LABEL_POST_NOW", gettext("Post now"));
     $portal->set_rss_feed(PATH_URL . "services/feeds/discussion_public.php?id=" . OBJ_ID, gettext("Feed"), gettext("Subscribe to this forum's Newsfeed"));
     // TODO: Passt der link?
     $rootlink = \lms_steam::get_link_to_root($messageboard);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => PATH_URL . "forums/" . $messageboard->get_id() . "/", "name" => $messageboard->get_name()), array("link" => "", "name" => gettext("Discussion")));
     $frameResponseObject->setTitle("Messageboard");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Пример #12
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //if (!defined("OBJ_ID")) define( "OBJ_ID", $weblog->get_id() );
     $weblogId = $this->id;
     $weblog = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $weblogId);
     if (!defined("OBJ_ID")) {
         define("OBJ_ID", $weblog->get_id());
     }
     $env = $weblog->get_environment();
     $grp = $env->get_creator();
     if ($grp->get_name() == "learners" && $grp->get_attribute(OBJ_TYPE) == "course_learners") {
         $grp = $grp->get_parent_group();
     }
     $accessmergel = FALSE;
     if (isset($weblog) && is_object($weblog)) {
         $creator = $weblog->get_creator();
         if ($weblog->get_attribute(KOALA_ACCESS) == PERMISSION_UNDEFINED && \lms_steam::get_current_user()->get_id() != $creator->get_id() && !\lms_steam::is_koala_admin(lms_steam::get_current_user())) {
             $accessmergel = TRUE;
         }
     }
     $backlink = empty($_POST["values"]["backlink"]) ? $_SERVER["HTTP_REFERER"] : $_POST["values"]["backlink"];
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = $_POST["values"];
         if (get_magic_quotes_gpc()) {
             if (!empty($values['name'])) {
                 $values['name'] = stripslashes($values['name']);
             }
             if (!empty($values['dsc'])) {
                 $values['dsc'] = stripslashes($values['dsc']);
             }
         }
         if (empty($values["name"])) {
             $problems = gettext("The name of the weblog is missing.");
             $hints = gettext("Please type in a name.");
         }
         if (strpos($values["name"], "/")) {
             if (!isset($problems)) {
                 $problems = "";
             }
             $problems .= gettext("Please don't use the \"/\"-char in the name of the weblog.");
         }
         if (empty($problems)) {
             $group_members = $grp;
             $group_admins = 0;
             $group_staff = 0;
             // check if group is a course
             $grouptype = (string) $grp->get_attribute("OBJ_TYPE");
             if ($grouptype == "course") {
                 $group_staff = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".staff");
                 $group_admins = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".admins");
                 $group_members = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".learners");
                 $workroom = $group_members->get_workroom();
             } else {
                 $workroom = $grp->get_workroom();
             }
             if (!isset($weblog) || !is_object($weblog)) {
                 $weblog_new = \steam_weblog::create_steam_structure($GLOBALS["STEAM"], $values["name"], $values["dsc"], $env);
                 $_SESSION["confirmation"] = str_replace("%NAME", h($values["name"]), gettext("New weblog '%NAME' created."));
             } else {
                 $weblog->set_attribute(OBJ_NAME, $values["name"]);
                 $weblog->set_attribute(OBJ_DESC, $values["dsc"]);
                 $frameResponseObject->setConfirmText(gettext("The changes have been saved."));
                 //$portal->set_confirmation( gettext( "The changes have been saved." ));
                 $weblog_new = $weblog;
             }
             //var_dump($weblog_new);die;
             $koala_weblog = new \lms_weblog($weblog_new);
             $access = (int) $values["access"];
             //var_dump($access);
             $access_descriptions = \lms_weblog::get_access_descriptions($grp);
             //var_dump(!$accessmergel);die;
             //if (!$accessmergel) $koala_weblog->set_access( $access, $access_descriptions[$access]["members"] , $access_descriptions[$access]["steam"], $group_members, $group_staff, $group_admins );
             // HIER DER NEUE CODE::ENDE
             $GLOBALS["STEAM"]->buffer_flush();
             $cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 600);
             $cache->drop("lms_steam::get_inventory_recursive", $workroom->get_id(), CLASS_CALENDAR, array("WEBLOG_LANGUAGE"));
             $cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
             if (!isset($weblog) || !is_object($weblog)) {
                 header("Location: " . $backlink);
                 exit;
             }
         } else {
             //TODO:PROBLEMDESCRIPTION
             //$portal->set_problem_description( $problems, isset($hints)?$hints:"" );
         }
     }
     $content = \Weblog::getInstance()->loadTemplate("object_new.template.html");
     //$content = new HTML_TEMPLATE_IT( PATH_TEMPLATES );
     //$content->loadTemplateFile( "object_new.template.html" );
     if (isset($weblog) && is_object($weblog)) {
         $content->setVariable("INFO_TEXT", str_replace("%NAME", h($weblog->get_name()), gettext("You are going to edit the weblog '<b>%NAME</b>'.")));
         $content->setVariable("LABEL_CREATE", gettext("Save changes"));
         $pagetitle = gettext("Preferences");
         if (empty($values)) {
             $values = array();
             $values["name"] = $weblog->get_name();
             $values["dsc"] = $weblog->get_attribute(OBJ_DESC);
             $values["access"] = $weblog->get_attribute(KOALA_ACCESS);
         }
         $breadcrumbheader = gettext("Preferences");
     } else {
         $grpname = $grp->get_attribute(OBJ_NAME);
         if ($grp->get_attribute(OBJ_TYPE) == "course") {
             $grpname = $grp->get_attribute(OBJ_DESC);
         }
         $content->setVariable("INFO_TEXT", str_replace("%ENV", h($grpname), gettext("You are going to create a new weblog in '<b>%ENV</b>'.")));
         $content->setVariable("LABEL_CREATE", gettext("Create weblog"));
         $pagetitle = gettext("Create weblog");
         $breadcrumbheader = gettext("Add new weblog");
     }
     if (!empty($values)) {
         if (!empty($values["name"])) {
             $content->setVariable("VALUE_NAME", h($values["name"]));
         }
         if (!empty($values["dsc"])) {
             $content->setVariable("VALUE_DSC", h($values["dsc"]));
         }
     }
     $content->setVariable("VALUE_BACKLINK", $backlink);
     $content->setVariable("LABEL_NAME", gettext("Name"));
     $content->setVariable("LABEL_DSC", gettext("Description"));
     $content->setVariable("LABEL_ACCESS", gettext("Access"));
     $content->setVariable("LABEL_BB_BOLD", gettext("B"));
     $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
     $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
     $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
     $content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
     $content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
     $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
     $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
     $content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
     $content->setVariable("HINT_BB_IMAGE", gettext("image"));
     $content->setVariable("LABEL_BB_URL", gettext("URL"));
     $content->setVariable("HINT_BB_URL", gettext("web link"));
     $content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
     $content->setVariable("HINT_BB_MAIL", gettext("email link"));
     if ($accessmergel) {
         $mailto = "mailto:'.SUPPORT_EMAIL.'?subject=KoaLA:%20Invalid%20Access%20Rights&body=" . rawurlencode("\nLink: " . get_current_URL() . "\nCreator: " . $creator->get_identifier() . "\n");
         $content->setCurrentBlock("BLOCK_ACCESSMERGEL");
         $content->setVariable("LABEL_ACCESSMERGEL", str_replace("%MAILTO", $mailto, gettext("There is a problem with the access settings. Please <a href=\"%MAILTO\">contact the support team</a> to fix it by setting the access rights again.")));
         $content->parse("BLOCK_ACCESSMERGEL");
     } else {
         $access = \lms_weblog::get_access_descriptions($grp);
         if ((string) $grp->get_attribute("OBJ_TYPE") == "course") {
             $access_default = PERMISSION_PUBLIC;
         } else {
             $access_default = PERMISSION_PUBLIC_READONLY;
             if (is_object($weblog) && $creator->get_id() != \lms_steam::get_current_user()->get_id()) {
                 $access[PERMISSION_PRIVATE_READONLY]["label"] = str_replace("%NAME", $creator->get_name(), $access[PERMISSION_PRIVATE_READONLY]["label"]);
             } else {
                 $access[PERMISSION_PRIVATE_READONLY]["label"] = gettext("Only members can read and comment. Only you can post.");
             }
         }
         if (is_array($access)) {
             $content->setCurrentBlock("BLOCK_ACCESS");
             foreach ($access as $key => $array) {
                 if ($key != PERMISSION_UNDEFINED || isset($values) && (int) $values["access"] == PERMISSION_UNDEFINED) {
                     $content->setCurrentBlock("ACCESS");
                     $content->setVariable("LABEL", $array["summary_short"] . ": " . $array["label"]);
                     $content->setVariable("VALUE", $key);
                     if (isset($values) && $key == (int) $values["access"] || empty($values) && $key == $access_default) {
                         $content->setVariable("CHECK", "checked=\"checked\"");
                     }
                     $content->parse("ACCESS");
                 }
             }
             $content->parse("BLOCK_ACCESS");
         }
     }
     $content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
     $rootlink = \lms_steam::get_link_to_root($grp);
     //var_dump($rootlink);die;
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")));
     if (isset($weblog) && is_object($weblog)) {
         $headline[] = array("link" => PATH_URL . "weblog/index/" . $weblog->get_id() . "/", "name" => $weblog->get_name());
     }
     $headline[] = array("link" => "", "name" => $breadcrumbheader);
     //$portal->set_page_main( $headline, $content->get() );
     //$portal->set_page_title( $pagetitle );
     //return $portal->get_html();
     $frameResponseObject->setHeadline($headline);
     $frameResponseObject->setTitle($pagetitle);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Пример #13
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $forum_id = $this->params[0];
     $portal = \lms_portal::get_instance();
     $user = \lms_steam::get_current_user();
     $rss_feeds = $user->get_attribute("USER_RSS_FEEDS");
     if (!($messageboard = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $forum_id))) {
         include "bad_link.php";
         exit;
     }
     if ($messageboard instanceof \steam_document) {
         $thread = $messageboard;
         $messageboard = $thread->get_annotating();
         define("OBJ_ID", $thread->get_id());
         if (!$thread->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     } else {
         define("OBJ_ID", $messageboard->get_id());
         if (!$messageboard->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     if (!$messageboard instanceof \steam_messageboard) {
         include "bad_link.php";
         exit;
     }
     $is_watching = FALSE;
     if (is_array($rss_feeds)) {
         foreach (array_keys($rss_feeds) as $item) {
             if ($item == $messageboard->get_id()) {
                 $is_watching = TRUE;
             }
         }
     }
     $content = \Messageboard::getInstance()->loadTemplate("forum_post.template.html");
     $headline = gettext("Post a new topic");
     // TODO: Passt der link?
     $backlink = empty($_POST["values"]["backlink"]) ? $_SERVER["HTTP_REFERER"] : $_POST["values"]["backlink"];
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = $_POST["values"];
         $problems = "";
         if (empty($values["title"])) {
             $problems = gettext("Please enter a subject for your message.");
         }
         if (empty($values["body"])) {
             $problems .= empty($problems) ? gettext("Please enter your message.") : "<br>" . gettext("Please enter your message.");
         }
         if (get_magic_quotes_gpc()) {
             if (!empty($values['title'])) {
                 $values['title'] = stripslashes($values['title']);
             }
             if (!empty($values['body'])) {
                 $values['body'] = stripslashes($values['body']);
             }
         }
         if (!empty($problems)) {
             $portal->set_problem_description($problems);
         }
         if (!empty($values["preview_comment"])) {
             $content->setCurrentBlock("BLOCK_PREVIEW_COMMENT");
             $content->setVariable("TEXT_COMMENT", get_formatted_output($values["body"]));
             $content->setVariable("LABEL_PREVIEW_YOUR_COMMENT", gettext("Preview your comment"));
             $template->parse("BLOCK_PREVIEW_COMMENT");
             $headline = gettext("Change it?");
         }
         if (!empty($values["save"]) && empty($problems)) {
             if (!strpos($values["title"], "/")) {
                 $new_thread = $messageboard->add_thread($values["title"], $values["body"]);
                 //      		$all_user = steam_factory::groupname_to_object( $GLOBALS[ "STEAM" ]->get_id(), STEAM_ALL_USER );
                 //      		$new_thread->set_acquire( FALSE );
                 //      		$new_thread->set_read_access( $all_user, TRUE );
                 //      		$new_thread->set_write_access( $all_user, FALSE );
                 //      		$new_thread->set_annotate_access( $all_user, TRUE );
                 // Handle Related Cache-Data
                 require_once "Cache/Lite.php";
                 $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
                 $cache->clean(OBJ_ID);
                 // clean forumcache
                 $fcache = get_cache_function($forum_id, 600);
                 $fcache->drop("lms_forum::get_discussions", $forum_id);
                 // clean rsscache of the forum
                 // TODO: Passt der link?
                 $feedlink = PATH_URL . "services/feeds/forum_public.php?id=" . $forum_id;
                 $rcache = get_cache_function("rss", 600);
                 $rcache->drop("lms_rss::get_items", $feedlink);
                 header("Location: " . PATH_URL . "messageboard/viewDiscussion/" . $new_thread->get_id() . "/");
                 exit;
             } else {
                 $portal->set_problem_description(gettext("Please don't use the \"/\"-char in the title."));
             }
         }
         if (!empty($values["preview"]) && !empty($values['body'])) {
             // PREVIEW
             $content->setCurrentBlock("BLOCK_PREVIEW");
             $content->setVariable("LABEL_PREVIEW_EDIT", gettext("Preview the edit"));
             $content->setVariable("PREVIEW_EDIT", get_formatted_output($values["body"]));
             $content->parse("BLOCK_PREVIEW");
             $headline = gettext("Change it?");
         }
     }
     $subject = isset($values["title"]) ? htmlentities($values["title"], ENT_NOQUOTES, "utf-8") : "";
     $text = isset($values["body"]) ? htmlentities($values["body"], ENT_NOQUOTES, "utf-8") : "";
     $content->setVariable("INFO_TEXT", $headline);
     $content->setVariable("LABEL_TOPIC", gettext("Topic"));
     $content->setVariable("LABEL_YOUR_POST", gettext("Your Post"));
     $content->setVariable("TEXT_COMMENT", $text);
     $content->setVariable("TITLE_COMMENT", $subject);
     $content->setVariable("LABEL_PREVIEW", gettext("Preview"));
     $content->setVariable("LABEL_SAVE_CHANGES", gettext("Create entry"));
     $content->setVariable("VALUE_BACKLINK", $backlink);
     $content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
     $content->setVariable("LABEL_BB_BOLD", gettext("B"));
     $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
     $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
     $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
     $content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
     $content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
     $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
     $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
     $content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
     $content->setVariable("HINT_BB_IMAGE", gettext("image"));
     $content->setVariable("LABEL_BB_URL", gettext("URL"));
     $content->setVariable("HINT_BB_URL", gettext("web link"));
     $content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
     $content->setVariable("HINT_BB_MAIL", gettext("email link"));
     $portal->set_rss_feed(PATH_URL . "services/feeds/forum_public.php?id={$forum_id}", gettext("Feed"), str_replace("%l", $login, gettext("Subscribe to this forum's Newsfeed")));
     // TODO: Passt der link?
     $rootlink = \lms_steam::get_link_to_root($messageboard);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => PATH_URL . "forums/" . $messageboard->get_id() . "/", "name" => $messageboard->get_name()), array("link" => "", "name" => gettext("New Thread")));
     $frameResponseObject->setTitle("Messageboard");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Пример #14
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     //$portal->set_confirmation();
     $user = \lms_steam::get_current_user();
     //$path = $request->getPath();
     $STEAM = $GLOBALS["STEAM"];
     $weblogId = $this->id;
     $weblog = \steam_factory::get_object($STEAM->get_id(), $weblogId);
     //if ( ! $weblog = steam_factory::get_object( $STEAM->get_id(), $_GET[ "id" ] ) )
     //{
     //	include( "bad_link.php" );
     //	exit;
     //}
     defined("OBJ_ID") or define("OBJ_ID", $weblogId);
     if (!$weblog instanceof \steam_calendar) {
         if ($weblog instanceof \steam_container) {
             $category = $weblog;
             $categories = $category->get_environment();
             $weblog = new \steam_weblog((string) $GLOBALS["STEAM"]->get_id(), $categories->get_environment()->get_id());
         } elseif ($weblog instanceof \steam_date) {
             $date = $weblog;
             $weblog = new \steam_weblog((string) $GLOBALS["STEAM"]->get_id(), $date->get_environment()->get_id());
         } else {
             include "bad_link.php";
             exit;
         }
     } else {
         $weblog = new \steam_weblog((string) $GLOBALS["STEAM"]->get_id(), $weblogId);
         //define( "OBJ_ID",	$weblogId );
         if (!$weblog->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     $html_entry = \Weblog::getInstance()->loadTemplate("weblog_entry.template.html");
     //$html_entry = new HTML_TEMPLATE_IT();
     //$html_entry->loadTemplateFile( PATH_TEMPLATES . "weblog_entry.template.html" );
     $weblog_html_handler = new \lms_weblog($weblog);
     if (isset($_GET["action"]) && $_GET["action"] == "bookmark_rss") {
         \lms_steam::user_add_rssfeed($weblog->get_id(), PATH_URL . "services/feeds/weblog_public.php?id=" . $weblog->get_id(), "weblog", \lms_steam::get_link_to_root($weblog));
         $_SESSION["confirmation"] = str_replace("%NAME", h($weblog->get_name()), gettext("You are keeping an eye on '%NAME' from now on."));
         header("Location: " . PATH_URL . "weblog/" . $date->get_id() . "/");
         exit;
     }
     if (isset($_GET["action"]) && $_GET["action"] == "delete_bookmark") {
         $user = \lms_steam::get_current_user();
         $id = (int) $_GET["unsubscribe"];
         $feeds = $user->get_attribute("USER_RSS_FEEDS");
         if (!is_array($feeds)) {
             $feeds = array();
         }
         unset($feeds[$id]);
         $user->set_attribute("USER_RSS_FEEDS", $feeds);
         $_SESSION["confirmation"] = str_replace("%NAME", h($weblog->get_name()), gettext("subscription of '%NAME' canceled."));
         header("Location: " . PATH_URL . "weblog/" . $date->get_id() . "/");
         exit;
     }
     $weblog_html_handler->set_menu("entry");
     $weblog_html_handler->set_widget_categories();
     $weblog_html_handler->set_widget_archive(5);
     $date = $weblog;
     $entry = $date->get_attributes(array("DATE_TITLE", "DATE_DESCRIPTION", "DATE_START_DATE", "DATE_CATEGORY", "OBJ_KEYWORDS"));
     $creator = $date->get_creator();
     $html_entry->setVariable("VALUE_ARTICLE_TEXT", get_formatted_output(h($date->get_attribute("DATE_DESCRIPTION"))));
     $html_entry->setVariable("VALUE_POSTED_BY", str_replace("%NAME", "<a href=\"" . PATH_URL . "user/" . $creator->get_name() . "/\">" . h($creator->get_attribute("USER_FIRSTNAME")) . " " . h($creator->get_attribute("USER_FULLNAME")) . "</a>", gettext("Posted by %NAME")));
     $html_entry->setVariable("VALUE_DATE_TIME", strftime("%x %X", h($entry["DATE_START_DATE"])));
     $category = $entry["DATE_CATEGORY"];
     if (!empty($category)) {
         $html_entry->setVariable("LABEL_IN", gettext("in"));
         $html_entry->setVariable("VALUE_CATEGORY", "<a href=\"" . PATH_URL . "weblog/" . $category->get_id() . "/\">" . h($category->get_name()) . "</a>");
     } else {
         $html_entry->setVariable("VALUE_CATEGORY", gettext("no category"));
     }
     $html_entry->setVariable("POST_PERMALINK", PATH_URL . "weblog/" . $weblog->get_id() . "/#comment" . $date->get_id());
     $html_entry->setVariable("POST_PERMALINK_LABEL", gettext("permalink"));
     $weblog_html_handler->set_main_html($html_entry->get() . self::get_comment_html($date, PATH_URL . "weblog/" . $date->get_id()));
     //TODO:RSS_FEED
     //$portal->set_rss_feed( PATH_URL . "services/feeds/weblog_public.php?id=" . OBJ_ID , gettext( "Feed" ), str_replace( "%l", (isset($login))?$login:'', gettext( "Subscribe to this forum's Newsfeed" ) ) );
     $rootlink = \lms_steam::get_link_to_root($weblog);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($weblog->get_name()), "link" => PATH_URL . "weblog/" . $weblog->get_id() . "/"), array("link" => "", "name" => h($date->get_attribute("DATE_TITLE"))));
     /*$portal->set_page_main(
     	 $headline,
     	 $weblog_html_handler->get_html()
     	 );
     	 $portal->show_html();*/
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($weblog_html_handler->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Пример #15
0
    } else {
        if (isset($weblog)) {
            $content->setVariable("DELETE_BACK_LINK", PATH_URL . "weblog/" . OBJ_ID . "/");
        } else {
            $content->setVariable("DELETE_BACK_LINK", PATH_URL . "forums/" . OBJ_ID . "/");
        }
    }
    $content->setCurrentBlock("BLOCK_DELETE");
    $content->setVariable("FORM_ACTION", $_SERVER["REQUEST_URI"]);
    $content->setVariable("LABEL_DELETE_IT", gettext("yes, delete it"));
    $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
    $content->setVariable("LABEL_RETURN", gettext("back"));
    $content->parse("BLOCK_DELETE");
} else {
    $content->setVariable("LABEL_ARE_YOU_SURE", gettext("You have no rights to delete this comment!"));
}
$content->setVariable("TEXT_COMMENT", get_formatted_output($comment->get_content()));
$creator = $comment->get_creator();
$creator_data = $creator->get_attributes(array("USER_FULLNAME", "USER_FIRSTNAME", "OBJ_ICON"));
$content->setVariable("LABEL_FROM_AND_AGO", str_replace("%N", "<a href=\"" . PATH_URL . "/user/" . $creator->get_name() . "/\">" . h($creator_data["USER_FIRSTNAME"]) . " " . h($creator_data["USER_FULLNAME"]) . "</a>", gettext("by %N")) . "," . how_long_ago($comment->get_attribute("OBJ_CREATION_TIME")));
$icon = $creator_data["OBJ_ICON"];
if ($icon instanceof steam_object) {
    $icon_id = $icon->get_id();
} else {
    $icon_id = 0;
}
$content->setVariable("ICON_SRC", PATH_URL . "get_document.php?id=" . $icon_id);
$rootlink = lms_steam::get_link_to_root($messageboard);
$headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => PATH_URL . "forums/" . $messageboard->get_id() . "/", "name" => $messageboard->get_name()), array("link" => "", "name" => gettext("Delete comment")));
$portal->set_page_main($headline, $content->get(), "");
$portal->show_html();
Пример #16
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $user = \lms_steam::get_current_user();
     // Disable caching
     // TODO: Work on cache handling. An enabled cache leads to bugs
     // if used with the wiki.
     \CacheSettings::disable_caching();
     if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
         include "bad_link.php";
         exit;
     }
     if (!$wiki_container instanceof \steam_container) {
         $wiki_doc = $wiki_container;
         $wiki_container = $wiki_doc->get_environment();
         if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
             include "bad_link.php";
             exit;
         }
     }
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $version_doc = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[1]);
     defined("OBJ_ID") or define("OBJ_ID", $wiki_doc->get_id());
     $is_prev_version = isset($version_doc) && is_object($version_doc) && $version_doc instanceof \steam_document ? TRUE : FALSE;
     $wiki_html_handler = new \lms_wiki($wiki_container);
     if (!$is_prev_version) {
         $wiki_html_handler->set_admin_menu("entry", $wiki_doc);
         $attributes = $wiki_doc->get_attributes(array("DOC_VERSION", "DOC_AUTHORS", "OBJ_LAST_CHANGED", "DOC_USER_MODIFIED", "DOC_TIMES_READ", "DOC_LAST_MODIFIED", "OBJ_WIKILINKS"));
         //TODO: check if sourcecode can be deleted
         //$wiki_html_handler->set_widget_links( $wiki_doc );
         //$wiki_html_handler->set_widget_previous_versions( $wiki_doc );
     } else {
         $wiki_html_handler->set_admin_menu("version", $version_doc);
         $attributes = $version_doc->get_attributes(array("DOC_VERSION", "DOC_AUTHORS", "OBJ_LAST_CHANGED", "DOC_USER_MODIFIED", "DOC_TIMES_READ", "DOC_LAST_MODIFIED", "OBJ_WIKILINKS"));
     }
     $last_author = $attributes["DOC_USER_MODIFIED"]->get_attributes(array("USER_FIRSTNAME", "USER_FULLNAME"));
     $content = \Wiki::getInstance()->loadTemplate("wiki_entry.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "wiki_entry.template.html" );
     $content->setVariable("LABEL_CLOSE", gettext("close"));
     if (!$is_prev_version) {
         $content->setVariable("VALUE_ENTRY_TEXT", wiki_to_html_plain($wiki_doc));
     } else {
         $content->setVariable("VALUE_ENTRY_TEXT", wiki_to_html_plain($wiki_doc, $version_doc));
     }
     $content->setVariable("IMAGE_SRC", PATH_URL . "download/image/" . $attributes["DOC_USER_MODIFIED"]->get_attribute("OBJ_ICON")->get_id() . "/60/70/");
     $content->setVariable("AUTHOR_LINK", PATH_URL . "user/index/" . $attributes["DOC_USER_MODIFIED"]->get_name() . "/");
     $content->setVariable("VALUE_POSTED_BY", h($last_author["USER_FIRSTNAME"]) . " " . h($last_author["USER_FULLNAME"]));
     $content->setVariable("LABEL_BY", gettext("created by"));
     $content->setVariable("VALUE_VERSION", h($attributes["DOC_VERSION"]));
     $content->setVariable("VALUE_DATE_TIME", strftime("%x %X", $attributes["DOC_LAST_MODIFIED"]));
     /*
     if(!$is_prev_version)
     {
     $content->setVariable( "POST_PERMALINK", PATH_URL . "wiki/" . $wiki_doc->get_id() . "/" );
     $content->setVariable( "POST_PERMALINK_LABEL", "(" . gettext( "permalink" ) . ")");
     }
     */
     if ($wiki_doc->check_access_write($user)) {
         $content->setCurrentBlock("BLOCK_ACCESS");
         $content->setVariable("POST_LABEL_DELETE", gettext("delete"));
         $content->setVariable("POST_LABEL_EDIT", gettext("edit"));
         $content->parse("BLOCK_ACCESS");
     }
     $versions = $wiki_doc->get_previous_versions();
     $no_versions = is_array($versions) ? count($versions) : 0;
     $content->setVariable("VERSION_MANAGEMENT", gettext("Version Management"));
     if ($no_versions > 0) {
         $content->setVariable("NUMBER_VERSIONS", "<li>" . $no_versions . " " . gettext("previous version(s) available") . "</li>");
         $content->setVariable("LINK_VERSION_MANAGEMENT", "<li><a href=\"" . PATH_URL . "wiki/versionoverview/" . $wiki_doc->get_id() . "/\">&raquo; " . gettext("enter version management") . "</a></li>");
     } else {
         $content->setVariable("NUMBER_VERSIONS", "<li>" . gettext("no previous versions available") . "</li>");
     }
     $content->setVariable("LINKS", gettext("Wiki Links"));
     $links = $wiki_doc->get_attribute("OBJ_WIKILINKS_CURRENT");
     $found_doc = false;
     if (is_array($links)) {
         foreach ($links as $doc) {
             if ($doc instanceof \steam_document) {
                 $found_doc = true;
                 break;
             }
         }
     }
     if (!$found_doc) {
         $content->setCurrentBlock("BLOCK_LINKS");
         $content->setVariable("LINK", gettext("no links available"));
         $content->parse("BLOCK_LINKS");
     } else {
         foreach ($links as $doc) {
             if ($doc instanceof \steam_document) {
                 $name = str_replace(".wiki", "", h($doc->get_name()));
                 $link = PATH_URL . "wiki/viewversion/" . $wiki_doc->get_id() . "/" . $doc->get_identifier();
                 $content->setVariable("LINK", '<li>&raquo; <a href="' . $link . '">' . $name . '</a></li>');
                 $content->parse("BLOCK_LINKS");
             }
         }
     }
     $wiki_html_handler->set_main_html($content->get());
     $rootlink = \lms_steam::get_link_to_root($wiki_container);
     WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/")) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/")));
     if (!$is_prev_version) {
         $headline[] = array("link" => "", "name" => str_replace(".wiki", "", h($wiki_doc->get_name())));
     } else {
         $headline[] = array("link" => PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name())));
         $headline[] = array("link" => PATH_URL . "wiki/versionoverview/" . $wiki_doc->get_id() . "/", "name" => gettext("Version management"));
         $headline[] = array("link" => "", "name" => "Version" . " " . $version_doc->get_version() . " (" . gettext("Preview") . ")");
     }
     /*$portal->set_page_main(
     	 $headline,
     	 $wiki_html_handler->get_html()
     	 );
     	 $portal->show_html();
     	 */
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($wiki_html_handler->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Пример #17
0
}
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "object_delete.template.html");
if ($object->check_access_write($user)) {
    $content->setVariable("LABEL_ARE_YOU_SURE", str_replace("%NAME", h($object->get_name()), gettext("Are you sure you want to delete the forum '%NAME' ?")));
    $rootlink = lms_steam::get_link_to_root($object);
    $content->setVariable("DELETE_BACK_LINK", $rootlink[1]["link"] . "communication/");
    $content->setCurrentBlock("BLOCK_DELETE");
    $content->setVariable("FORM_ACTION", $_SERVER["REQUEST_URI"]);
    $content->setVariable("LABEL_DELETE_IT", gettext("yes, delete it"));
    $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
    $content->setVariable("LABEL_RETURN", gettext("back"));
    $content->parse("BLOCK_DELETE");
} else {
    $content->setVariable("LABEL_ARE_YOU_SURE", gettext("You have no rights to delete this forum!"));
}
$content->setVariable("TEXT_INFORMATION", gettext("The forum and all its entries be deleted."));
$creator = $object->get_creator();
$creator_data = $creator->get_attributes(array("USER_FULLNAME", "USER_FIRSTNAME", "OBJ_ICON"));
$content->setVariable("LABEL_FROM_AND_AGO", str_replace("%N", "<a href=\"" . PATH_URL . "/user/" . $creator->get_name() . "/\">" . h($creator_data["USER_FIRSTNAME"]) . " " . h($creator_data["USER_FULLNAME"]) . "</a>", gettext("by %N")) . "," . how_long_ago($object->get_attribute("OBJ_CREATION_TIME")));
$icon = $creator_data["OBJ_ICON"];
if ($icon instanceof steam_object) {
    $icon_id = $icon->get_id();
} else {
    $icon_id = 0;
}
$content->setVariable("ICON_SRC", PATH_URL . "get_document.php?id=" . $icon_id);
$rootlink = lms_steam::get_link_to_root($object);
$headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => "", "name" => h($object->get_name()), "link" => PATH_URL . "forums/" . $object->get_id() . "/"), array("name" => gettext("Delete forum")));
$portal->set_page_main($headline, $content->get(), "");
$portal->show_html();
Пример #18
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     //$portal->set_confirmation();
     $user = \lms_steam::get_current_user();
     //$path = $request->getPath();
     $STEAM = $GLOBALS["STEAM"];
     $weblogId = $this->id;
     $weblog = \steam_factory::get_object($STEAM->get_id(), $weblogId);
     //if ( ! $weblog = steam_factory::get_object( $STEAM->get_id(), $_GET[ "id" ] ) )
     //{
     //	include( "bad_link.php" );
     //	exit;
     //}
     if (!$weblog instanceof \steam_calendar) {
         if ($weblog instanceof \steam_container) {
             $category = $weblog;
             $categories = $category->get_environment();
             $weblog = new \steam_weblog((string) $GLOBALS["STEAM"]->get_id(), $categories->get_environment()->get_id());
         } elseif ($weblog instanceof \steam_date) {
             $date = $weblog;
             $weblog = new \steam_weblog((string) $GLOBALS["STEAM"]->get_id(), $date->get_environment()->get_id());
         } else {
             include "bad_link.php";
             exit;
         }
     } else {
         $weblog = new \steam_weblog((string) $GLOBALS["STEAM"]->get_id(), $weblogId);
         define("OBJ_ID", $weblogId);
         if (!$weblog->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     $content = \Weblog::getInstance()->loadTemplate("weblog_post.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "weblog_post.template.html" );
     $headline = gettext("Post a new entry");
     if ($_SERVER["REQUEST_METHOD"] == "GET") {
         $content->setVariable("VALUE_BACK_LINK", $_SERVER["HTTP_REFERER"]);
     } else {
         $values = $_POST["values"];
         if (get_magic_quotes_gpc()) {
             if (!empty($values['title'])) {
                 $values['title'] = stripslashes($values['title']);
             }
             if (!empty($values['body'])) {
                 $values['body'] = stripslashes($values['body']);
             }
         }
         if (!empty($values["save"])) {
             $problem = "";
             $hint = "";
             if (empty($values["title"])) {
                 $problem .= gettext("The title is missing.") . "&nbsp;";
                 $hint .= gettext("Please add the missing values.");
             }
             if (empty($values["body"])) {
                 $problem .= gettext("There is no message for your readers.") . "&nbsp;";
                 $hint .= gettext("Please write your post into the text area.");
             }
             if (!empty($values["category"]) && $values["category"] != 0) {
                 $category = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $values["category"]);
                 if (!$category instanceof \steam_container) {
                     throw new \Exception("Not a valid category: " . $values["category"]);
                 }
             } else {
                 $category = "";
             }
             if (!($timestamp = strtotime($values["date"] . ":00"))) {
                 $problem .= gettext("I cannot parse the date and time.");
                 $hint .= gettext("Please verify your date and time format") . ": YYYY-MM-DD HH:MM";
             }
             if (strpos($values["title"], "/")) {
                 if (!isset($problem)) {
                     $problem = "";
                 }
                 $problem .= gettext("Please don't use the \"/\"-char in the subject of your post.");
             }
             if (empty($problem)) {
                 $new_entry = $weblog->create_entry($values["title"], $values["body"], $category, array(), $timestamp);
                 if ($values["podcast"] != 0) {
                     $new_entry->set_attribute("DATE_PODCAST", $values["podcast"]);
                 }
                 // Handle Related Cache-Data
                 require_once "Cache/Lite.php";
                 $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
                 $cache->clean(OBJ_ID);
                 // clean weblogcache
                 $bcache = get_cache_function($_GET["id"], 600);
                 $bcache->drop("lms_weblog::get_items", $_GET["id"]);
                 // clean rsscache of the weblog
                 $feedlink = PATH_URL . "services/feeds/weblog_public.php?id=" . $_GET["id"];
                 $rcache = get_cache_function("rss", 600);
                 $rcache->drop("lms_rss::get_items", $feedlink);
                 header("Location: " . PATH_URL . "weblog/index/" . $weblog->get_id() . "/");
                 exit;
             } else {
                 // TODO:THERE IS A PROBLEM
                 //$portal->set_problem_description( $problem, $hint );
                 $content->setVariable("TEXT_COMMENT", h($values["body"]));
                 $content->setVariable("TITLE_COMMENT", h($values["title"]));
             }
         } else {
             // PREVIEW
             $content->setCurrentBlock("BLOCK_PREVIEW");
             $content->setVariable("LABEL_PREVIEW_EDIT", gettext("Preview the edit"));
             $content->setVariable("PREVIEW_EDIT", get_formatted_output($values["body"]));
             $content->parse("BLOCK_PREVIEW");
             $headline = gettext("Change it?");
             $content->setVariable("TEXT_COMMENT", h($values["body"]));
             $content->setVariable("TITLE_COMMENT", h($values["title"]));
         }
     }
     $backlink = empty($_POST["values"]["return_to"]) ? $_SERVER["HTTP_REFERER"] : $_POST["values"]["return_to"];
     $content->setVariable("VALUE_BACK_LINK", $backlink);
     $content->setVariable("POST_NEW_ENTRY_TEXT", $headline);
     $content->setVariable("INFO_TEXT", "some hints about blogging");
     $content->setVariable("LABEL_DATE", gettext("Date"));
     $content->setVariable("INFO_FORMAT", gettext("Format: YYYY-MM-DD HH:MM"));
     $date = empty($values["date"]) ? strftime("%Y-%m-%d %H:%M") : $values["date"];
     $content->setVariable("DATE_COMMENT", h($date));
     $content->setVariable("LABEL_SUBJECT", gettext("Subject"));
     $content->setVariable("LABEL_YOUR_POST", gettext("Your Post"));
     $content->setVariable("LABEL_CATEGORY", gettext("Category"));
     $content->setVariable("LINK_NEW_CATEGORY", PATH_URL . "weblog/categorycreate/" . $weblog->get_id());
     $content->setVariable("LABEL_NEW_CATEGORY", gettext("Want to add a new category?"));
     $content->setVariable("CAT_NO_SELECTION", gettext("nothing selected"));
     $categories = $weblog->get_categories();
     $selection = empty($values["category"]) ? isset($_GET["category"]) ? $_GET["category"] : '' : $values["category"];
     foreach ($categories as $category) {
         $content->setCurrentBlock("BLOCK_SELECT_CAT");
         $content->setVariable("VALUE_CAT", $category->get_id());
         $content->setVariable("LABEL_CAT", h($category->get_name()));
         if ($category->get_id() == $selection) {
             $content->setVariable("CAT_SELECTED", 'selected="selected"');
         }
         $content->parse("BLOCK_SELECT_CAT");
     }
     /*
     $content->setVariable( "LABEL_PODCAST", gettext( "Podcast") );
     $content->setVariable( "PODCAST_NO_SELECTION", gettext( "nothing selected" ) );
     $content->setVariable( "LINK_UPLOAD_MULTIMEDIA", PATH_URL . "weblog/" . $weblog->get_id() . "/podcast/" );
     $content->setVariable( "LABEL_UPLOAD_MULTIMEDIA", gettext( "Want to upload an audio or video file?" ) );
     $files_in_podspace = $weblog->get_podspace()->get_inventory( CLASS_DOCUMENT );
     foreach( $files_in_podspace as $file )
     {
     $content->setCurrentBlock( "BLOCK_MULTIMEDIA" );
     $content->setVariable( "VALUE_MULTIMEDIA", $file->get_id() );
     if ( ( $file->get_id() == $_GET[ "podcast" ] ) || ( $file->get_id() == $values[ "podcast" ] ) )
     {
     $content->setVariable( "MULTIMEDIA_SELECTED", 'selected="selected"' );
     }
     $content->setVariable( "LABEL_MULTIMEDIA", h($file->get_name()) );
     $content->parse( "BLOCK_MULTIMEDIA" );
     }
     */
     $content->setVariable("LABEL_BB_BOLD", gettext("B"));
     $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
     $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
     $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
     $content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
     $content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
     $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
     $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
     $content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
     $content->setVariable("HINT_BB_IMAGE", gettext("image"));
     $content->setVariable("LABEL_BB_URL", gettext("URL"));
     $content->setVariable("HINT_BB_URL", gettext("web link"));
     $content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
     $content->setVariable("HINT_BB_MAIL", gettext("email link"));
     $content->setVariable("LABEL_PREVIEW", gettext("Preview"));
     $content->setVariable("LABEL_SAVE_CHANGES", gettext("Save changes"));
     $content->setVariable("LABEL_RETURN", gettext("back"));
     //TODO:RSS-FEED
     //$portal->set_rss_feed( PATH_URL . "services/feeds/weblog_public.php?id=" . $weblog->get_id(), gettext( "Feed" ), str_replace( "%l", (isset($login))?$login:'', gettext( "Subscribe to this forum's Newsfeed" ) ) );
     $rootlink = \lms_steam::get_link_to_root($weblog);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($weblog->get_name()), "link" => PATH_URL . "weblog/" . $weblog->get_id() . "/"), array("link" => "", "name" => gettext("New Post")));
     /*$portal->set_page_main(
     			$headline,
     			$content->get()
     		);
     		return $portal->get_html();*/
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Пример #19
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //var_dump($GLOBALS[ "STEAM" ]->get_id());
     //		$portal = \lms_portal::get_instance();
     //		$portal->initialize( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //		$path = $request->getPath();
     $STEAM = $GLOBALS["STEAM"];
     $weblogId = $this->id;
     $weblog = \steam_factory::get_object($STEAM->get_id(), $weblogId);
     //if ( ! $weblog = steam_factory::get_object( $STEAM->get_id(), $_GET[ "id" ] ) )
     //{
     //	include( "bad_link.php" );
     //	exit;
     //}
     if (!$weblog instanceof \steam_calendar) {
         if ($weblog instanceof \steam_container) {
             $category = $weblog;
             $categories = $category->get_environment();
             $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $categories->get_environment()->get_id());
         } elseif ($weblog instanceof \steam_date) {
             $date = $weblog;
             $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $date->get_environment()->get_id());
         } else {
             include "bad_link.php";
             exit;
         }
     } else {
         $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $weblogId);
         define("OBJ_ID", $weblogId);
         if (!$weblog->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     $content = \Weblog::getInstance()->loadTemplate("weblog_entry_edit.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "weblog_entry_edit.template.html" );
     if ($_SERVER["REQUEST_METHOD"] == "GET") {
         $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST" && $date->check_access_write($user)) {
         $values = $_POST["values"];
         if (!empty($values["save"])) {
             $problem = "";
             $hint = "";
             if (empty($values["title"])) {
                 $problem .= gettext("The title is missing.") . "&nbsp;";
                 $hint .= gettext("Please add the missing values.");
             }
             if (empty($values["body"])) {
                 $problem .= gettext("There is no message for your readers.") . "&nbsp;";
                 $hint .= gettext("Please write your post into the text area.");
             }
             if (!empty($values["category"]) && $values["category"] != 0) {
                 $category = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $values["category"]);
                 if (!$category instanceof \steam_container) {
                     throw new \Exception("Not a valid category: " . $values["category"]);
                 }
             } else {
                 $category = "";
             }
             if (!($timestamp = strtotime($values["date"] . ":00"))) {
                 $problem .= gettext("I cannot parse the date and time.");
                 $hint .= gettext("Please verify your date and time format") . ": YYYY-MM-DD HH:MM";
             }
             if (empty($problem)) {
                 require_once "Cache/Lite.php";
                 $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
                 $cache->clean($weblog->get_id());
                 $cache->clean($date->get_id());
                 $attributes = array("DATE_START_DATE" => $timestamp, "DATE_TITLE" => $values["title"], "DATE_DESCRIPTION" => $values["body"]);
                 $date->set_attributes($attributes);
                 $weblog->categorize_entry($date, $category);
                 header("Location: " . $values["return_to"]);
                 exit;
             } else {
                 //TODO: PROBLEMDESCRIPTION
                 //$portal->set_problem_description( $problem, $hint );
             }
         }
         if ($values["preview"]) {
             $content->setCurrentBlock("BLOCK_PREVIEW");
             $content->setVariable("LABEL_PREVIEW_EDIT", gettext("Preview the edit"));
             $content->setVariable("PREVIEW_EDIT", get_formatted_output($values["body"]));
             $content->parse("BLOCK_PREVIEW");
         }
     }
     $content->setVariable("LABEL_HERE_IT_IS", "");
     $content->setVariable("LABEL_DATE", gettext("Date"));
     $content->setVariable("LABEL_SUBJECT", gettext("Subject"));
     $content->setVariable("LABEL_CATEGORY", gettext("Category"));
     $content->setVariable("CAT_NO_SELECTION", gettext("nothing selected"));
     $content->setVariable("LABEL_YOUR_POST", gettext("Your post"));
     $content->setVariable("LABEL_PREVIEW", gettext("Preview"));
     $content->setVariable("LABEL_SAVE_CHANGES", gettext("Save changes"));
     $content->setVariable("LABEL_RETURN", gettext("back"));
     $content->setVariable("LABEL_BB_BOLD", gettext("B"));
     $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
     $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
     $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
     $content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
     $content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
     $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
     $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
     $content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
     $content->setVariable("HINT_BB_IMAGE", gettext("image"));
     $content->setVariable("LABEL_BB_URL", gettext("URL"));
     $content->setVariable("HINT_BB_URL", gettext("web link"));
     $content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
     $content->setVariable("HINT_BB_MAIL", gettext("email link"));
     if (isset($values) && count($values)) {
         // FORMULAR WURDE SCHON EINMAL ABGESCHICKT
         $date_value = empty($values["date"]) ? strftime("%Y-%m-%d %H:%M") : $values["date"];
         $content->setVariable("DATE_COMMENT", h($date_value));
         $content->setVariable("TEXT_COMMENT", h($values["body"]));
         $content->setVariable("TITLE_COMMENT", h($values["title"]));
         $cat = $values["category"];
         $content->setVariable("BACK_LINK", $values["return_to"]);
     } else {
         $attribs = $date->get_attributes(array("DATE_START_DATE", "DATE_TITLE", "DATE_DESCRIPTION", "DATE_CATEGORY"));
         $content->setVariable("DATE_COMMENT", strftime("%Y-%m-%d %H:%M", $attribs["DATE_START_DATE"]));
         $content->setVariable("TITLE_COMMENT", h($attribs["DATE_TITLE"]));
         $content->setVariable("TEXT_COMMENT", h($attribs["DATE_DESCRIPTION"]));
         $content->setVariable("TITLE_COMMENT", h($attribs["DATE_TITLE"]));
         $cat = is_object($attribs["DATE_CATEGORY"]) ? $attribs["DATE_CATEGORY"]->get_id() : 0;
     }
     $categories = $weblog->get_categories();
     foreach ($categories as $category) {
         $content->setCurrentBlock("BLOCK_SELECT_CAT");
         $content->setVariable("VALUE_CAT", $category->get_id());
         $content->setVariable("LABEL_CAT", h($category->get_name()));
         if ($category->get_id() == $cat) {
             $content->setVariable("CAT_SELECTED", 'selected="selected"');
         }
         $content->parse("BLOCK_SELECT_CAT");
     }
     $rootlink = \lms_steam::get_link_to_root($weblog);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => "", "name" => h($weblog->get_name()), "link" => PATH_URL . "weblog/" . $weblog->get_id() . "/"), array("name" => str_replace("%NAME", h($date->get_attribute("DATE_TITLE")), gettext("Edit '%NAME'?"))));
     /*$portal->set_page_main(
     		$headline,
     		$content->get(),
     		""
     		);
     		return $portal->get_html();*/
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Пример #20
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //$path = $request->getPath();
     $STEAM = $GLOBALS["STEAM"];
     $weblogId = $this->id;
     $weblog = \steam_factory::get_object($STEAM->get_id(), $weblogId);
     //if ( ! $weblog = steam_factory::get_object( $STEAM->get_id(), $_GET[ "id" ] ) )
     //{
     //	include( "bad_link.php" );
     //	exit;
     //}
     $category = $weblog;
     if (!$weblog instanceof \steam_calendar) {
         if ($weblog instanceof \steam_container) {
             $category = $weblog;
             $categories = $category->get_environment();
             $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $categories->get_environment()->get_id());
         } elseif ($weblog instanceof \steam_date) {
             $date = $weblog;
             $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $date->get_environment()->get_id());
         } else {
             include "bad_link.php";
             exit;
         }
     } else {
         $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $weblogId);
         defined("OBJ_ID") or define("OBJ_ID", $weblogId);
         if (!$weblog->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     $weblog_html_handler = new \lms_weblog($weblog);
     $weblog_html_handler->set_menu("category");
     $weblog_html_handler->set_widget_categories();
     $weblog_html_handler->set_widget_archive(5);
     $link_objects = $category->get_inventory(CLASS_LINK);
     $no_entries = count($link_objects);
     $end = $no_entries;
     $start = 0;
     $date_objects = array();
     for ($i = $start; $i < $end; $i++) {
         $date_objects[] = $link_objects[$i]->get_source_object();
     }
     usort($date_objects, "sort_dates");
     //sort_dates defined in steam_calendar.class
     $weblog_html_handler->print_entries($date_objects);
     //TODO: Login korrekt ersetzen
     $login = "";
     //	$portal->set_rss_feed( PATH_URL . "services/feeds/weblog_public.php?id=" . OBJ_ID , gettext( "Feed" ), str_replace( "%l", $login, gettext( "Subscribe to this forum's Newsfeed" ) ) );
     $rootlink = \lms_steam::get_link_to_root($weblog);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($weblog->get_name()), "link" => PATH_URL . "weblog/" . $weblog->get_id() . "/"), array("link" => "", "name" => h($category->get_name())));
     /*$portal->set_page_main(
     		$headline,
     		$weblog_html_handler->get_html()
     		);
     		return $portal->get_html();
     	*/
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($weblog_html_handler->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Пример #21
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $forum_id = $this->params[0];
     $portal = \lms_portal::get_instance();
     $user = \lms_steam::get_current_user();
     $rss_feeds = $user->get_attribute("USER_RSS_FEEDS");
     if (!($messageboard = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $forum_id))) {
         include "bad_link.php";
         exit;
     }
     if ($messageboard instanceof \steam_document) {
         $thread = $messageboard;
         $messageboard = $thread->get_annotating();
         define("OBJ_ID", $thread->get_id());
         if (!$thread->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     } else {
         define("OBJ_ID", $messageboard->get_id());
         if (!$messageboard->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     if (!$messageboard instanceof \steam_messageboard) {
         include "bad_link.php";
         exit;
     }
     $is_watching = FALSE;
     if (is_array($rss_feeds)) {
         foreach (array_keys($rss_feeds) as $item) {
             if ($item == $messageboard->get_id()) {
                 $is_watching = TRUE;
             }
         }
     }
     $object = $messageboard;
     $user = \lms_steam::get_current_user();
     if ($_SERVER["REQUEST_METHOD"] == "POST" && $object->check_access_write($user)) {
         $values = $_POST["values"];
         if ($values["delete"]) {
             $_SESSION["confirmation"] = str_replace("%NAME", h($object->get_name()), gettext("The forum '%NAME' has been deleted."));
             $workroom = $object->get_environment();
             \lms_steam::delete($object);
             // Clean Cache for the deleted Forum
             require_once "Cache/Lite.php";
             $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
             $cache = get_cache_function(OBJ_ID, 600);
             $cache->drop("lms_steam::get_annotations", OBJ_ID);
             // Handle Related Cache-Data
             require_once "Cache/Lite.php";
             $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
             $cache->clean(OBJ_ID);
             // clean forum cache
             $fcache = get_cache_function(OBJ_ID, 600);
             $fcache->drop("lms_forum::get_discussions", OBJ_ID);
             // clean cache for forum RSS Feed for the Comments
             $fcache->drop("lms_steam::get_annotations", OBJ_ID);
             // clean rsscache
             $rcache = get_cache_function("rss", 600);
             // TODO: Passt der link?
             $feedlink = PATH_URL . "services/feeds/forum_public.php?id=" . OBJ_ID;
             $rcache->drop("lms_rss::get_items", $feedlink);
             // Clean communication summary cache für the group/course
             if (is_object($workroom)) {
                 $cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 600);
                 $cache->drop("lms_steam::get_inventory_recursive", $workroom->get_id(), CLASS_MESSAGEBOARD, array("FORUM_LANGUAGE"));
                 $cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
             }
             header("Location: " . PATH_URL . "group/index");
             exit;
         }
     }
     $content = \Messageboard::getInstance()->loadTemplate("object_delete.template.html");
     if ($object->check_access_write($user)) {
         $content->setVariable("LABEL_ARE_YOU_SURE", str_replace("%NAME", h($object->get_name()), gettext("Are you sure you want to delete the forum '%NAME' ?")));
         // TODO: Passt der link?
         $rootlink = \lms_steam::get_link_to_root($object);
         $content->setVariable("DELETE_BACK_LINK", $rootlink[1]["link"] . "communication/");
         $content->setCurrentBlock("BLOCK_DELETE");
         $content->setVariable("FORM_ACTION", $_SERVER["REQUEST_URI"]);
         $content->setVariable("LABEL_DELETE_IT", gettext("yes, delete it"));
         $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
         $content->setVariable("LABEL_RETURN", gettext("back"));
         $content->parse("BLOCK_DELETE");
     } else {
         $content->setVariable("LABEL_ARE_YOU_SURE", gettext("You have no rights to delete this forum!"));
     }
     $content->setVariable("TEXT_INFORMATION", gettext("The forum and all its entries be deleted."));
     $creator = $object->get_creator();
     $creator_data = $creator->get_attributes(array("USER_FULLNAME", "USER_FIRSTNAME", "OBJ_ICON"));
     $content->setVariable("LABEL_FROM_AND_AGO", str_replace("%N", "<a href=\"" . PATH_URL . "/user/" . $creator->get_name() . "/\">" . h($creator_data["USER_FIRSTNAME"]) . " " . h($creator_data["USER_FULLNAME"]) . "</a>", gettext("by %N")) . "," . how_long_ago($object->get_attribute("OBJ_CREATION_TIME")));
     $icon = $creator_data["OBJ_ICON"];
     if ($icon instanceof \steam_object) {
         $icon_id = $icon->get_id();
     } else {
         $icon_id = 0;
     }
     $content->setVariable("ICON_SRC", PATH_URL . "get_document.php?id=" . $icon_id);
     // TODO: Passt der Link?
     $rootlink = \lms_steam::get_link_to_root($object);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => "", "name" => h($object->get_name()), "link" => PATH_URL . "forums/" . $object->get_id() . "/"), array("name" => gettext("Delete forum")));
     $frameResponseObject->setTitle("Messageboard");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Пример #22
0
        $content->setVariable("TITLE_COMMENT", h($values["title"]));
    }
}
if (empty($values)) {
    $content->setVariable("TEXT_DSC", h($category->get_attribute("OBJ_DESC")));
    $content->setVariable("TITLE_COMMENT", h($category->get_name()));
}
$content->setVariable("LABEL_HERE_IT_IS", "");
$content->setVariable("LABEL_TITLE", gettext("Title"));
$content->setVariable("LABEL_DESC", gettext("Description"));
$content->setVariable("LABEL_BB_BOLD", gettext("B"));
$content->setVariable("HINT_BB_BOLD", gettext("boldface"));
$content->setVariable("LABEL_BB_ITALIC", gettext("I"));
$content->setVariable("HINT_BB_ITALIC", gettext("italic"));
$content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
$content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
$content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
$content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
$content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
$content->setVariable("HINT_BB_IMAGE", gettext("image"));
$content->setVariable("LABEL_BB_URL", gettext("URL"));
$content->setVariable("HINT_BB_URL", gettext("web link"));
$content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
$content->setVariable("HINT_BB_MAIL", gettext("email link"));
$content->setVariable("LABEL_PREVIEW", gettext("Preview"));
$content->setVariable("LABEL_SAVE_CHANGES", gettext("Save changes"));
$content->setVariable("LABEL_RETURN", gettext("back"));
$rootlink = lms_steam::get_link_to_root($weblog);
$headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($weblog->get_name()), "link" => PATH_URL . "weblog/" . $weblog->get_id() . "/"), array("link" => PATH_URL . "weblog/" . $category->get_id() . "/", "name" => h($category->get_name())), array("link" => "", "name" => str_replace("%NAME", h($category->get_name()), gettext("Edit '%NAME'"))));
$portal->set_page_main($headline, $content->get());
$portal->show_html();
Пример #23
0
    }
    if (!isset($backlink) || empty($backlink)) {
        $upper_link = lms_steam::get_link_to_root($document);
        $backlink = $upper_link["link"];
    }
    if (lms_steam::delete($document)) {
        $_SESSION["confirmation"] = str_replace("%DOC_NAME", $doc_name, gettext("%DOC_NAME successfully deleted."));
        // DASS DAS DOKUMENT IRGENDWO IM CACHE LIEGT, IST MIR ZZT NICHT BEKANNT.
        // FALLS CACHE-BEREINIGUNG NOTWENDIG IST, DANN HIER.
        header("Location: " . $backlink);
        exit;
    } else {
        throw new Exception("Cannot delete document");
    }
}
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "document_delete.template.html");
$content->setVariable("FORM_ACTION", "");
$content->setVariable("LABEL_ARE_YOU_SURE", gettext("Are you sure?"));
$content->setVariable("INFO_DELETE_DOCUMENT", str_replace("%DOCNAME", h($document->get_name()), gettext("You are going to delete %DOCNAME.")));
$content->setVariable("LABEL_DELETE_IT", gettext("YES, DELETE THIS DOCUMENT"));
$content->setVariable("DELETE_BACK_LINK", $_SERVER["HTTP_REFERER"]);
$content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
$content->setVariable("LABEL_RETURN", gettext("back"));
// TEST
//				$env = $document->get_environment();
//				if ( is_object( $env ) && is_object( $koala_container = koala_object::get_koala_object( $env ) ) )
//					$backlink = $koala_container->get_url();
//error_log("backlink=" . $backlink);
$portal->set_page_main(array(lms_steam::get_link_to_root($env), array("link" => "", "name" => h($document->get_name()))), $content->get(), "");
$portal->show_html();
Пример #24
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $user = \lms_steam::get_current_user();
     // Disable caching
     // TODO: Work on cache handling. An enabled cache leads to bugs
     // if used with the wiki.
     \CacheSettings::disable_caching();
     if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
         include "bad_link.php";
         exit;
     }
     if (!$wiki_container instanceof \steam_container) {
         $wiki_doc = $wiki_container;
         $wiki_container = $wiki_doc->get_environment();
         if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
             include "bad_link.php";
             exit;
         }
     }
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     if ($wiki_doc != null) {
         if (@$_REQUEST["force_delete"]) {
             // is deleted entry wiki startpage ?
             $entryName = $wiki_doc->get_name();
             $startpage = $wiki_container->get_attribute("OBJ_WIKI_STARTPAGE") . ".wiki";
             if ($entryName == $startpage) {
                 $wiki_container->set_attribute("OBJ_WIKI_STARTPAGE", "glossary");
             }
             \lms_steam::delete($wiki_doc);
             // clean wiki cache (not used by wiki)
             $cache = get_cache_function($wiki_container->get_id(), 600);
             $cache->clean("lms_wiki::get_items", $wiki_container->get_id());
             $_SESSION["confirmation"] = gettext("Wiki entry deleted sucessfully");
             // clean rsscache
             $rcache = get_cache_function("rss", 600);
             $feedlink = PATH_URL . "services/feeds/wiki_public.php?id=" . $wiki_container->get_id();
             $rcache->drop("lms_rss::get_items", $feedlink);
             header("Location: " . PATH_URL . "wiki/deleteentry/" . $wiki_container->get_id() . "/");
         } else {
             $wiki_name = h(substr($wiki_doc->get_name(), 0, -5));
             $content = \Wiki::getInstance()->loadTemplate("wiki_delete.template.html");
             //$content = new HTML_TEMPLATE_IT();
             //$content->loadTemplateFile( PATH_TEMPLATES . "wiki_delete.template.html" );
             $content->setVariable("LABEL_ARE_YOU_SURE", str_replace("%NAME", h($wiki_name), gettext("Are you sure you want to delete the wiki page '%NAME' ?")));
             $content->setVariable("LABEL_DELETE", gettext('Delete'));
             $content->setVariable("LABEL_OR", gettext('or'));
             $content->setVariable("LABEL_CANCEL", gettext('Cancel'));
             $content->setVariable("FORM_ACTION", $_SERVER["REQUEST_URI"]);
             $content->setVariable("BACK_LINK", PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/");
             //Breadcrumbs
             $rootlink = \lms_steam::get_link_to_root($wiki_container);
             WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => "", "name" => gettext("Delete"))) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => "", "name" => gettext("Delete"))));
             /*$portal->set_page_main($headline, $content->get(), "");
             		$portal->show_html();*/
             $frameResponseObject->setHeadline($headline);
             $widget = new \Widgets\RawHtml();
             $widget->setHtml($content->get());
             $frameResponseObject->addWidget($widget);
             return $frameResponseObject;
         }
     }
 }
Пример #25
0
    public function execute(\FrameResponseObject $frameResponseObject)
    {
        //CODE FOR ALL COMMANDS OF THIS PAKAGE END
        $user = \lms_steam::get_current_user();
        // Disable caching
        // TODO: Work on cache handling. An enabled cache leads to bugs
        // if used with the wiki.
        \CacheSettings::disable_caching();
        if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
            include "bad_link.php";
            exit;
        }
        if (!$wiki_container instanceof \steam_container) {
            $wiki_doc = $wiki_container;
            $wiki_container = $wiki_doc->get_environment();
            if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
                include "bad_link.php";
                exit;
            }
        }
        //CODE FOR ALL COMMANDS OF THIS PAKAGE END
        defined("OBJ_ID") or define("OBJ_ID", $wiki_container->get_id());
        $content = \Wiki::getInstance()->loadTemplate("wiki_edit.template.html");
        //$content = new HTML_TEMPLATE_IT();
        //$content->loadTemplateFile( PATH_TEMPLATES . "wiki_edit.template.html" );
        $wiki_entries = $wiki_container->get_inventory(CLASS_DOCUMENT);
        foreach ($wiki_entries as $wiki_entry) {
            if ($wiki_entry->get_attribute(DOC_MIME_TYPE) === "text/wiki") {
                $name = $wiki_entry->get_name();
                $content->setCurrentBlock("BLOCK_WIKI_ENTRY_OPTION");
                $content->setVariable("WIKI_ENTRY_OPTION", "<option value=\"{$name}\">{$name}</option>");
                $content->parse("BLOCK_WIKI_ENTRY_OPTION");
            }
        }
        $problems = "";
        if (!isset($create)) {
            $create = FALSE;
        }
        if ($_SERVER["REQUEST_METHOD"] == "POST") {
            $values = $_POST["values"];
            if (get_magic_quotes_gpc()) {
                if (!empty($values['title'])) {
                    $values['title'] = stripslashes($values['title']);
                }
                if (!empty($values['body'])) {
                    $values['body'] = stripslashes($values['body']);
                }
            }
            if (empty($values["title"])) {
                $problems = gettext("Please enter a subject for your message.");
            }
            if (empty($values["body"])) {
                $problems .= empty($problems) ? gettext("Please enter your message.") : "<br>" . gettext("Please enter your message.");
            }
            if (strpos($values["title"], "/")) {
                if (!isset($problems)) {
                    $problems = "";
                }
                $problems .= gettext("Please don't use the \"/\"-char in the subject of your post.");
            }
            if (empty($problems)) {
                $wiki_content = str_replace("@", "&#64;", $values["body"]);
                if (!empty($values['save'])) {
                    if ($create) {
                        $wiki_doc = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $values["title"] . ".wiki", $wiki_content, "text/wiki", $wiki_container, "");
                    } else {
                        // PRUEFEN, OB ALLES OK, DANN NEUE WERTE SPEICHERN
                        $wiki_doc->set_name($values['title'] . ".wiki");
                        $wiki_doc->set_content($wiki_content);
                    }
                    // Clean cache for wiki_entries
                    $cache = get_cache_function($wiki_container->get_id(), 600);
                    $cache->clean($wiki_container->get_id());
                    // clean rsscache
                    $rcache = get_cache_function("rss", 600);
                    $feedlink = PATH_URL . "services/feeds/wiki_public.php?id=" . $wiki_container->get_id();
                    $rcache->drop("lms_rss::get_items", $feedlink);
                    header("Location: " . PATH_URL . "wiki/editentry/" . $wiki_doc->get_id() . "/");
                    exit;
                } else {
                    // PREVIEW
                    $content->setCurrentBlock("BLOCK_PREVIEW");
                    $content->setVariable("LABEL_PREVIEW_EDIT", gettext("Preview the description"));
                    $content->setVariable("PREVIEW_EDIT", get_formatted_output($values["desc"]));
                    $content->parse("BLOCK_PREVIEW");
                    $headline = gettext("Change it?");
                    $content->setVariable("TEXT_DSC", h($values["desc"]));
                    $content->setVariable("TITLE_COMMENT", h($values["title"]));
                }
            } else {
                $frameResponseObject->setProblemDescription($problems);
                //$portal->set_problem_description( $problems );
            }
        }
        if (empty($values)) {
            $wikicontent = "";
            $wikiname = "";
            if (!$create) {
                $wikicontent = $wiki_doc->get_content();
                $wikicontent = str_replace("&#64;", "@", $wikicontent);
                $wikiname = $wiki_doc->get_name();
            }
            if (WIKI_WYSIWYG) {
                //TODO
                $content->setVariable("TEXT_DSC", h($wikicontent));
                //$content->setVariable( "TEXT_DSC", wikitext_to_html( h($wikicontent), $wiki_container->get_id() ) );
                //$content->setVariable( "NIC_SCRIPT", PATH_JAVASCRIPT . "niceditor/nicEdit.js");
            } else {
                $content->setVariable("TEXT_DSC", h($wikicontent));
            }
            $content->setVariable("TITLE_COMMENT", str_replace(".wiki", "", h($wikiname)));
            $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
        } else {
            $content->setVariable("TITLE_COMMENT", h($values["title"]));
            if (isset($values["body"])) {
                $content->setVariable("TEXT_DSC", h($values["body"]));
            }
        }
        $content->setVariable("LABEL_HERE_IT_IS", "");
        $content->setVariable("LABEL_TITLE", gettext("Title"));
        $content->setVariable("LABEL_BODY", gettext("Body"));
        //$content->setVariable( "LABEL_WIKI_H2", gettext( "H2" ) );
        //$content->setVariable( "HINT_WIKI_H2", gettext( "heading (level 2)" ) );
        //$content->setVariable( "LABEL_WIKI_H3", gettext( "H3" ) );
        //$content->setVariable( "HINT_WIKI_H3", gettext( "heading (level 3)" ) );
        //$content->setVariable( "LABEL_WIKI_BOLD", gettext( "'''B'''" ) );
        //$content->setVariable( "HINT_WIKI_BOLD", gettext( "boldface" ) );
        //$content->setVariable( "LABEL_WIKI_ITALIC", gettext( "''I''" ) );
        //$content->setVariable( "HINT_WIKI_ITALIC", gettext( "italic" ) );
        //$content->setVariable( "LABEL_WIKI_BULLET_LIST", gettext( "* list" ) );
        //$content->setVariable( "HINT_WIKI_BULLET_LIST", gettext( "bullet list" ) );
        //$content->setVariable( "LABEL_WIKI_NUMBERED_LIST", gettext( "# list" ) );
        //$content->setVariable( "HINT_WIKI_NUMBERED_LIST", gettext( "numbered list" ) );
        //$content->setVariable( "LABEL_WIKI_LINE", gettext( "-----" ) );
        //$content->setVariable( "HINT_WIKI_LINE", gettext( "horizontal line" ) );
        //$content->setVariable( "LABEL_WIKI_LINK", gettext( "[[wiki]]" ) );
        //$content->setVariable( "HINT_WIKI_LINK", gettext( "wiki link" ) );
        //$content->setVariable( "LABEL_WIKI_URL", gettext( "[URL]" ) );
        //$content->setVariable( "HINT_WIKI_URL", gettext( "web link" ) );
        //$content->setVariable( "LABEL_WIKI_IMAGE", gettext( "IMG" ) );
        //$content->setVariable( "HINT_WIKI_IMAGE", gettext( "image" ) );
        $content->setVariable("LABEL_PREVIEW", gettext("Preview"));
        $content->setVariable("LABEL_SAVE_CHANGES", gettext("Save changes"));
        $content->setVariable("LABEL_RETURN", gettext("back"));
        $content->setVariable("JS_NOTICE", '"' . gettext("Warning!\\nYou have edited your entry!\\nIf you proceed, all changes will be lost!\\nDo you really want to proceed?") . '"');
        // widget: Images
        //$widget = new HTML_TEMPLATE_IT();
        //$widget->loadTemplateFile( PATH_TEMPLATES . "widget_wiki_images.template.html" );
        $inventory = $wiki_container->get_inventory();
        if (!is_array($inventory)) {
            $inventory = array();
        }
        if (sizeof($inventory) > 0) {
            \steam_factory::load_attributes($GLOBALS["STEAM"]->get_id(), $inventory, array(OBJ_NAME, OBJ_DESC, DOC_MIME_TYPE));
            $images = array();
            foreach ($inventory as $object) {
                $mime = strtolower($object->get_attribute(DOC_MIME_TYPE));
                if ($mime === "image/jpg" || $mime === "image/jpeg" || $mime === "image/gif" || $mime === "image/png") {
                    $images[] = $object;
                }
            }
            if (empty($images)) {
                $content->setCurrentBlock("BLOCK_WIKI_ENTRY_NOIMAGE");
                $content->setVariable("WIKI_ENTRY_NOIMAGE", "Es befinden sich keine Bilder in der Mediathek.");
                $content->parse("BLOCK_WIKI_ENTRY_NOIMAGE");
            } else {
                $i = 0;
                foreach ($images as $image) {
                    $path = PATH_URL . "download/image/" . $image->get_id() . "/40/80/";
                    $content->setCurrentBlock("BLOCK_WIKI_ENTRY_IMAGE");
                    $content->setVariable("WIKI_ENTRY_IMAGE", <<<END
<table style="float:left">
\t<tr>
\t\t<td>
\t\t\t<input id="image{$i}" type="radio" name="images" value="{$image->get_name()}"/>
\t\t</td>
\t\t<td>
\t\t\t<img src="{$path}" title="{$image->get_name()}">
\t\t</td>
\t</tr>
</table>  \t
END
);
                    $content->parse("BLOCK_WIKI_ENTRY_IMAGE");
                    $i++;
                    //$widget->setCurrentBlock("BLOCK_IMAGE");
                    //$widget->setVariable("WIKI_IMAGE_NAME", $image->get_name());
                    //$widget->setVariable("WIKI_IMAGE_ADD_LINK", "javascript:insert('[[Image:" . $image->get_identifier() . "]]', '', 'formular', 'values[body]')");
                    //$widget->setVariable("WIKI_IMAGE_LINK", PATH_URL . "get_document.php?id=" . $image->get_id() . "&width=40&height=80");
                    //$widget->setVariable("WIKI_IMAGE_VIEW_LINK", PATH_URL . "doc/" . $image->get_id() . "/");
                    //$widget->setVariable("WIKI_IMAGE_TITLE", $image->get_name());
                    //$widget->setVariable("WIKI_IMAGE_ADD", gettext("Insert"));
                    //$widget->setVariable("WIKI_IMAGE_VIEW", gettext("View"));
                    //$widget->parse("BLOCK_IMAGE");
                }
            }
        }
        //$widget->setVariable("UPLOAD_TEXT", gettext("Upload an image"));
        //$widget->setVariable("UPLOAD_LINK", PATH_URL . "upload/?env=" . $wiki_container->get_id());
        //$widget->setVariable("WIKI_IMAGE_EXTERNAL", gettext("External image"));
        //$widget->setVariable("WIKI_IMAGE_EXTERNAL_LINK", "javascript:insert('[[Image:http://', ']]', 'formular', 'values[body]')");
        //$content->setCurrentBlock("BLOCK_WIDGET");
        //$content->setVariable("WIDGET_TITLE", gettext("Images"));
        //$content->setVariable("WIDGET_HTML_CODE", $widget->get());
        //$content->parse("BLOCK_WIDGET");
        if ($create) {
            $pagetitle = gettext("New Article");
        } else {
            $pagetitle = str_replace("%NAME", h(substr($wiki_doc->get_name(), 0, -5)), gettext("Edit '%NAME'?"));
        }
        $rootlink = \lms_steam::get_link_to_root($wiki_container);
        WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => "", "name" => $pagetitle)) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => "", "name" => $pagetitle)));
        /*$portal->set_page_main(
        		$headline,
        		$content->get()
        		);
        		$portal->show_html();
        		*/
        $frameResponseObject->setHeadline($headline);
        $rawHtml = new \Widgets\RawHtml();
        $rawHtml->setHtml($content->get());
        $frameResponseObject->addWidget($rawHtml);
        return $frameResponseObject;
    }
Пример #26
0
            $access[PERMISSION_PRIVATE_READONLY] = str_replace("%NAME", $creator->get_name(), $access[PERMISSION_PRIVATE_READONLY]);
        } else {
            $access[PERMISSION_PRIVATE_READONLY] = str_replace("%NAME", "you", $access[PERMISSION_PRIVATE_READONLY]);
        }
    }
    if (is_array($access)) {
        $content->setCurrentBlock("BLOCK_ACCESS");
        foreach ($access as $key => $array) {
            if ($key != PERMISSION_UNDEFINED || isset($values) && (int) $values["access"] == PERMISSION_UNDEFINED) {
                $content->setCurrentBlock("ACCESS");
                $content->setVariable("LABEL", $array["summary_short"] . ": " . $array["label"]);
                $content->setVariable("VALUE", $key);
                if (isset($values) && $key == (int) $values["access"] || empty($values) && $key == $access_default) {
                    $content->setVariable("CHECK", "checked=\"checked\"");
                }
                $content->parse("ACCESS");
            }
        }
        $content->parse("BLOCK_ACCESS");
    }
}
$content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
$rootlink = lms_steam::get_link_to_root($grp);
$headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")));
if (isset($wiki_container) && is_object($wiki_container)) {
    $headline[] = array("link" => PATH_URL . "wiki/" . $wiki_container->get_id() . "/", "name" => h($wiki_container->get_name()));
}
$headline[] = array("link" => "", "name" => $breadcrumbheader);
$portal->set_page_main($headline, $content->get());
$portal->set_page_title($pagetitle);
$portal->show_html();
Пример #27
0
        $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 = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "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"));
$portal->set_page_main(array(lms_steam::get_link_to_root($steam_group), array("link" => "", "name" => gettext("Delete group"))), $content->get(), "");
$portal->show_html();
Пример #28
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $user = \lms_steam::get_current_user();
     // Disable caching
     // TODO: Work on cache handling. An enabled cache leads to bugs
     // if used with the wiki.
     \CacheSettings::disable_caching();
     if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
         include "bad_link.php";
         exit;
     }
     if (!$wiki_container instanceof \steam_container) {
         $wiki_doc = $wiki_container;
         $wiki_container = $wiki_doc->get_environment();
         if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
             include "bad_link.php";
             exit;
         }
     }
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $wiki_html_handler = new \lms_wiki($wiki_container);
     $wiki_html_handler->set_admin_menu("mediathek", $wiki_container);
     $content = \Wiki::getInstance()->loadTemplate("wiki_mediathek.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "wiki_mediathek.template.html" );
     // get images
     $inventory = $wiki_container->get_inventory();
     if (!is_array($inventory)) {
         $inventory = array();
     }
     if (sizeof($inventory) > 0) {
         \steam_factory::load_attributes($GLOBALS["STEAM"]->get_id(), $inventory, array(OBJ_NAME, OBJ_DESC, DOC_MIME_TYPE));
         $images = array();
         foreach ($inventory as $object) {
             $mime = strtolower($object->get_attribute(DOC_MIME_TYPE));
             if ($mime === "image/jpg" || $mime === "image/jpeg" || $mime === "image/gif" || $mime === "image/png") {
                 $images[] = $object;
             }
         }
         foreach ($images as $image) {
             $actions = '<a href="' . PATH_URL . 'doc/' . $image->get_id() . '/">' . gettext("show properties") . '</a><br>';
             $actions .= '<a href="' . PATH_URL . 'doc/' . $image->get_id() . '/edit/">' . gettext("edit properties") . '</a><br>';
             $actions .= '<a href="' . PATH_URL . 'doc/' . $image->get_id() . '/deleteImage/" onclick="return confirmDeletion();">' . gettext("delete image") . '</a>';
             $imageData = imagecreatefromstring($image->get_content());
             $width = $newWidth = imagesx($imageData);
             $height = $newHeight = imagesy($imageData);
             if ($width > 160) {
                 $newHeight = (int) ($height * 160 / $width);
                 $newWidth = 160;
             }
             if ($newHeight > 80) {
                 $newWidth = (int) ($newWidth * 80 / $newHeight);
                 $newHeight = 80;
             }
             $content->setCurrentBlock("BLOCK_IMAGE");
             $content->setVariable("IMAGE_NAME", $image->get_name());
             $content->setVariable("IMAGE_ID", $image->get_id());
             $content->setVariable("IMAGE_DESCRIPTION", $image->get_attribute('OBJ_DESC'));
             $content->setVariable("IMAGE_LINK", PATH_URL . "download/image/" . $image->get_id() . "/" . $newWidth . "/" . $newHeight . "/");
             $content->setVariable("PREVIEW_LINK", "javascript:showBox(" . $image->get_id() . "," . $width . "," . $height . ");");
             $content->setVariable("IMAGE_ACTIONS", $actions);
             $content->parse("BLOCK_IMAGE");
         }
     }
     $question = gettext("Do you really want to delete this image?");
     $note = gettext("NOTE: All wiki-entries containing this image have to be updated manually!");
     $content->setVariable("QUESTION", $question);
     $content->setVariable("NOTE", $note);
     $content->setVariable("LABEL_CLOSE", gettext("close"));
     $content->setVariable("BACK_LINK", PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/");
     $content->setVariable("BACK_LABEL", gettext("back"));
     $wiki_html_handler->set_main_html($content->get());
     // breadcrumbs
     $rootlink = \lms_steam::get_link_to_root($wiki_container);
     WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => "", "name" => gettext("Mediathek"))) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => "", "name" => gettext("Mediathek"))));
     /*$portal->set_page_main(
     		$headline,
     		$wiki_html_handler->get_html()
     		);
     		$portal->show_html();
     		*/
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($wiki_html_handler->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Пример #29
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $forum_id = $this->params[0];
     $comment_id = $this->params[1];
     $portal = \lms_portal::get_instance();
     $user = \lms_steam::get_current_user();
     $rss_feeds = $user->get_attribute("USER_RSS_FEEDS");
     if (!($messageboard = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $forum_id))) {
         include "bad_link.php";
         exit;
     }
     if ($messageboard instanceof \steam_document) {
         $thread = $messageboard;
         $messageboard = $thread->get_annotating();
         define("OBJ_ID", $thread->get_id());
         if (!$thread->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     } else {
         define("OBJ_ID", $messageboard->get_id());
         if (!$messageboard->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     if (!$messageboard instanceof \steam_messageboard) {
         include "bad_link.php";
         exit;
     }
     $is_watching = FALSE;
     if (is_array($rss_feeds)) {
         foreach (array_keys($rss_feeds) as $item) {
             if ($item == $messageboard->get_id()) {
                 $is_watching = TRUE;
             }
         }
     }
     $comment = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $comment_id);
     $content = \Messageboard::getInstance()->loadTemplate("comment_edit.template.html");
     if ($_SERVER["REQUEST_METHOD"] == "GET") {
         $content->setVariable("LABEL_HERE_IT_IS", "");
         $content->setVariable("TEXT_COMMENT", h($comment->get_content()));
         $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
     } else {
         $values = $_POST["values"];
         if (!empty($values["save"])) {
             $comment->set_content($values["message"]);
             require_once "Cache/Lite.php";
             // Handle Related Cache-Data (for the case that the subject may be editable in the future)
             require_once "Cache/Lite.php";
             $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
             $cache->clean(OBJ_ID);
             // clean forumcache
             $fcache = get_cache_function(OBJ_ID, 600);
             $fcache->drop("lms_forum::get_discussions", OBJ_ID);
             // clean cache for Weblog RSS Feed for the Comments
             $cache = get_cache_function(OBJ_ID, 600);
             $discussions = $cache->drop("lms_steam::get_annotations", OBJ_ID);
             // clean rsscache
             $rcache = get_cache_function("rss", 600);
             // TODO: Passt der link?
             $feedlink = PATH_URL . "services/feeds/forum_public.php?id=" . OBJ_ID;
             $rcache->drop("lms_rss::get_items", $feedlink);
             // TODO: Passt der link?
             $feedlink = PATH_URL . "services/feeds/weblog_public.php?id=" . OBJ_ID;
             $rcache->drop("lms_rss::get_items", $feedlink);
             header("Location: " . $values["return_to"]);
             exit;
         } else {
             // PREVIEW
             $content->setCurrentBlock("BLOCK_PREVIEW");
             $content->setVariable("LABEL_PREVIEW_EDIT", gettext("Preview the edit"));
             $content->setVariable("PREVIEW_EDIT", get_formatted_output($values["message"]));
             $content->parse("BLOCK_PREVIEW");
             $content->setVariable("LABEL_HERE_IT_IS", gettext("Change it?"));
             $content->setVariable("TEXT_COMMENT", h($values["message"]));
             $content->setVariable("BACK_LINK", $values["return_to"]);
         }
     }
     $content->setVariable("LABEL_BB_BOLD", gettext("B"));
     $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
     $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
     $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
     $content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
     $content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
     $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
     $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
     $content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
     $content->setVariable("HINT_BB_IMAGE", gettext("image"));
     $content->setVariable("LABEL_BB_URL", gettext("URL"));
     $content->setVariable("HINT_BB_URL", gettext("web link"));
     $content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
     $content->setVariable("HINT_BB_MAIL", gettext("email link"));
     $content->setVariable("LABEL_PREVIEW", gettext("Preview"));
     $content->setVariable("LABEL_SAVE_CHANGES", gettext("Save changes"));
     $content->setVariable("LABEL_RETURN", gettext("back"));
     // TODO: Passt der link?
     $rootlink = \lms_steam::get_link_to_root($messageboard);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => PATH_URL . "forums/" . $messageboard->get_id() . "/", "name" => $messageboard->get_name()), array("link" => "", "name" => gettext("Edit a comment")));
     $frameResponseObject->setTitle("Messageboard");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Пример #30
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     if (!defined("OBJ_ID")) {
         define("OBJ_ID", $weblog->get_id());
     }
     $user = \lms_steam::get_current_user();
     $STEAM = $GLOBALS["STEAM"];
     $weblogId = $this->id;
     $weblog = \steam_factory::get_object($STEAM->get_id(), $weblogId);
     if (!defined("OBJ_ID")) {
         define("OBJ_ID", $weblog->get_id());
     }
     /*if ( ! $weblog = \steam_factory::get_object( $STEAM->get_id(), $_GET[ "id" ] ) )
     		{	
     			include( "bad_link.php" );
     			exit;
     		}*/
     if (!$weblog instanceof \steam_calendar) {
         if ($weblog instanceof \steam_container) {
             $category = $weblog;
             $categories = $category->get_environment();
             $weblog = new \steam_weblog((string) $GLOBALS["STEAM"]->get_id(), $categories->get_environment()->get_id());
         } elseif ($weblog instanceof \steam_date) {
             $date = $weblog;
             $weblog = new \steam_weblog((string) $GLOBALS["STEAM"]->get_id(), $date->get_environment()->get_id());
         } else {
             include "bad_link.php";
             exit;
         }
     } else {
         $weblog = new \steam_weblog((string) $GLOBALS["STEAM"]->get_id(), $weblogId);
         //define( "OBJ_ID",	$weblogId );
         if (!$weblog->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     $object = $weblog;
     $user = \lms_steam::get_current_user();
     if ($_SERVER["REQUEST_METHOD"] == "POST" && $object->check_access_write($user)) {
         $values = $_POST["values"];
         if ($values["delete"]) {
             $_SESSION["confirmation"] = str_replace("%NAME", h($object->get_name()), gettext("The weblog '%NAME' has been deleted."));
             $workroom = $object->get_environment();
             \lms_steam::delete($object);
             // Clean Cache for the deleted Weblog
             require_once "Cache/Lite.php";
             $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
             $cache = get_cache_function(OBJ_ID, 600);
             $cache->drop("lms_steam::get_annotations", OBJ_ID);
             // Handle Related Cache-Data
             require_once "Cache/Lite.php";
             $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
             $cache->clean(OBJ_ID);
             // clean weblog cache (not used by weblog)
             // $fcache = get_cache_function( OBJ_ID, 600 );
             //$fcache->drop( "lms_forum::get_discussions",  OBJ_ID );
             // clean cache for Weblog RSS Feed for the Comments (not used by weblog)
             // $fcache->drop( "lms_steam::get_annotations", OBJ_ID );
             // clean rsscache
             $rcache = get_cache_function("rss", 600);
             $feedlink = PATH_URL . "services/feeds/weblog_public.php?id=" . OBJ_ID;
             $rcache->drop("lms_rss::get_items", $feedlink);
             // Clean communication summary cache für the group/course
             if (is_object($workroom)) {
                 $cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 600);
                 $cache->drop("lms_steam::get_inventory_recursive", $workroom->get_id(), CLASS_CALENDAR, array("WEBLOG_LANGUAGE"));
                 $cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
             }
             header("Location: " . $values["return_to"]);
             exit;
         }
     }
     $content = \Weblog::getInstance()->loadTemplate("object_delete.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "object_delete.template.html" );
     if ($object->check_access_write($user)) {
         $content->setVariable("LABEL_ARE_YOU_SURE", str_replace("%NAME", h($object->get_name()), gettext("Are you sure you want to delete the weblog '%NAME' ?")));
         $rootlink = \lms_steam::get_link_to_root($object);
         $content->setVariable("DELETE_BACK_LINK", $rootlink[1]["link"] . "communication/");
         $content->setCurrentBlock("BLOCK_DELETE");
         $content->setVariable("FORM_ACTION", $_SERVER["REQUEST_URI"]);
         $content->setVariable("LABEL_DELETE_IT", gettext("yes, delete it"));
         $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
         $content->setVariable("LABEL_RETURN", gettext("back"));
         $content->parse("BLOCK_DELETE");
     } else {
         $content->setVariable("LABEL_ARE_YOU_SURE", gettext("You have no rights to delete this weblog!"));
     }
     $content->setVariable("TEXT_INFORMATION", gettext("The weblog and all its entries will be deleted."));
     $creator = $object->get_creator();
     $creator_data = $creator->get_attributes(array("USER_FULLNAME", "USER_FIRSTNAME", "OBJ_ICON"));
     $content->setVariable("LABEL_FROM_AND_AGO", str_replace("%N", "<a href=\"" . PATH_URL . "/user/" . $creator->get_name() . "/\">" . h($creator_data["USER_FIRSTNAME"]) . " " . h($creator_data["USER_FULLNAME"]) . "</a>", gettext("by %N")) . "," . how_long_ago($object->get_attribute("OBJ_CREATION_TIME")));
     $icon = $creator_data["OBJ_ICON"];
     if ($icon instanceof steam_object) {
         $icon_id = $icon->get_id();
     } else {
         $icon_id = 0;
     }
     $content->setVariable("ICON_SRC", PATH_URL . "get_document.php?id=" . $icon_id);
     $rootlink = \lms_steam::get_link_to_root($object);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => "", "name" => h($object->get_name()), "link" => PATH_URL . "weblog/" . $object->get_id() . "/"), array("name" => gettext("Delete weblog")));
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
     /*$portal->set_page_main(
     		$headline,
     		$content->get(),
     		""
     		);
     		$portal->show_html();*/
 }