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.") . " "; $hint .= gettext("Please add the missing values."); } if (empty($values["body"])) { $problem .= gettext("There is no message for your readers.") . " "; $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; }
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"], $weblog->get_id()); define("OBJ_ID", $weblog->get_id()); if (!$weblog->check_access_read($user)) { throw new Exception("No rights to view this.", E_USER_RIGHTS); } } if (!$weblog instanceof steam_weblog) { include "bad_link.php"; exit; } switch (TRUE) { case !(stripos($path[0], "deletecomment") === FALSE) && $date: $comment_id = substr($path[0], 13); define("OBJ_ID", $date->get_id()); include "comment_delete.php"; exit;
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; }
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.") . " "; $hint .= gettext("Please add the missing values."); } if (empty($values["body"])) { $problem .= gettext("There is no message for your readers.") . " "; $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; }
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; }
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->params[0]; if (!defined("OBJ_ID")) { define("OBJ_ID", $weblogId); } $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 { header("location: /404/"); 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); //var_dump($weblog_html_handler);die; $weblog_html_handler->set_menu("entries"); $grp = $weblog->get_environment()->get_creator(); \steam_factory::load_attributes($GLOBALS["STEAM"]->get_id(), array($grp), array(OBJ_NAME, OBJ_TYPE)); if ($grp->get_name() == "learners" && $grp->get_attribute(OBJ_TYPE) == "course_learners") { $grp = $grp->get_parent_group(); } $weblog_html_handler->set_widget_categories(); $all_date_objects = $weblog->get_date_objects(); usort($all_date_objects, "sort_dates"); //sort_dates defined in steam_calendar.class $weblog_html_handler->set_widget_archive(5); $weblog_html_handler->set_widget_blogroll(); $weblog_html_handler->set_widget_access($grp); 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/index/" . $weblog->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/index/" . $weblog->get_id() . "/"); exit; } //TODO what is the reason for this structure? switch (TRUE) { case isset($date) && $date: $weblog_html_handler->print_entries(array($date), FALSE); break; default: $weblog_html_handler->print_entries($all_date_objects); break; } $weblog_html_handler->set_podcast_link(); //$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); //var_dump($rootlink);die; //var_dump($rootlink);die; $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => "", "name" => h($weblog->get_name()))); //$portal->set_page_main( //$headline, //$weblog_html_handler->get_html() //); //var_dump($portal);die; //return $portal->get_html(); $frameResponseObject->setHeadline($headline); $widget = new \Widgets\RawHtml(); $widget->setHtml($weblog_html_handler->get_html()); $frameResponseObject->addWidget($widget); return $frameResponseObject; }
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"], $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); if (!defined("OBJ_ID")) { define("OBJ_ID", $weblogId); } if (!$weblog->check_access_read($user)) { throw new \Exception("No rights to view this.", E_USER_RIGHTS); } } if ($_SERVER["REQUEST_METHOD"] == "POST" && $category->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()); $link_objects = $category->get_inventory(CLASS_LINK); foreach ($link_objects as $link_object) { $date_object = $link_object->get_source_object(); $link_object->delete(); if ($values["delete_all_dates"]) { $date_object->delete(); } else { $date_object->set_attribute("DATE_CATEGORY", "0"); } } $category->delete(); } header("Location: " . PATH_URL . "weblog/" . $weblog->get_id() . "/"); exit; } $content = \Weblog::getInstance()->loadTemplate("weblog_category_delete.template.html"); //$content = new HTML_TEMPLATE_IT(); //$content->loadTemplateFile( PATH_TEMPLATES . "weblog_category_delete.template.html" ); $content->setVariable("LABEL_ARE_YOU_SURE", gettext("Are you sure you want to delete this category?")); $content->setVariable("NAME_CATEGORY", h($category->get_name())); $content->setVariable("TEXT_CATEGORY", get_formatted_output($category->get_attribute("OBJ_DESC"))); $content->setVariable("LABEL_DELETE_ALL_DATES", str_replace("%NO", count($category->get_inventory(CLASS_LINK)), gettext("Should all %NO entries in this category be deleted, too?"))); $content->setVariable("LABEL_DELETE_IT", gettext("yes, delete it")); $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]); $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("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; }
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->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"]->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); } } $date = $weblog; //if(!isset($date)) //throw new \Exception("variable date is not set."); //if ( $_SERVER[ "REQUEST_METHOD" ] == "POST" && $date->check_access_write( $user ) ) if (false) { $values = $_POST["values"]; if (!isset($values["delete"])) { $values["delete"] = false; } 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; } if ($_SERVER["REQUEST_METHOD"] == "POST") { //echo "hund"; $values = $_POST["values"]; $problem = ""; $hint = ""; if (isset($values["save"])) { $values["save"] = true; } else { $values["save"] = false; } if ($values["save"]) { if (empty($values["url"])) { $problem = gettext("The URL is missing.") . " "; $hint = gettext("Please insert the URL, starting with 'http://'") . " "; } if (empty($values["name"])) { $problem .= gettext("The name is missing."); $hint .= gettext("How is the title of the webpage?"); } else { if (strpos($values["name"], "/")) { if (!isset($problem)) { $problem = ""; } $problem .= gettext("Please don't use the \"/\"-char in the name of the blogroll entry."); } } if (empty($problem)) { $environment = $weblog->get_blogroll(); if (!is_object($environment)) { throw new \Exception("Environment is not correct."); } if (!$environment instanceof \steam_container) { throw new \Exception("Environment is no container."); } if (!$environment->check_access_write($user)) { throw new \Exception("No write access on this container.", E_USER_RIGHTS); } if (empty($problem)) { $docextern = \steam_factory::create_docextern($GLOBALS["STEAM"]->get_id(), $values["name"], $values["url"], $environment, $values["desc"]); header("Location: " . $values["return_to"]); exit; } else { //TODO: PROBDESC //$portal->set_problem_description( $problem, $hint ); } } else { //TODO: PROBDESC //$portal->set_problem_description( $problem, $hint ); } } } $content = \Weblog::getInstance()->loadTemplate("weblog_blogroll.template.html"); //$content = new HTML_TEMPLATE_IT(); //$content->loadTemplatefile( PATH_TEMPLATES . "weblog_blogroll.template.html" ); if (!empty($problem)) { $content->setVariable("VALUE_NAME", $values["name"]); $content->setVariable("VALUE_URL", $values["url"]); $content->setVariable("VALUE_DESC", $values["desc"]); } $content->setVariable("GREETING", str_replace("%n", $_SESSION["LMS_USER"]->get_forename(), gettext("Hi %n!"))); $help_text = "<b>" . gettext("What is a blogroll?") . "</b> " . gettext("A blogroll is a collection of links to other weblogs.") . " " . gettext("When present, blogrolls are on the front page sidebar of most weblogs.") . " " . gettext("Some blogrolls also simply consist of the list of weblogs an author reads himself."); $content->setVariable("HELP_TEXT", $help_text); $content->setVariable("YOUR_BLOGROLL_TEXT", gettext("Your Blogroll")); $content->setVariable("CREATE_NEW_LINK_TEXT", gettext("Create new Link")); $content->setVariable("FORM_ACTION", ""); //PATH_URL . "docextern_create.php" ); $content->setVariable("ENVIRONMENT", $weblog->get_blogroll()->get_id()); $content->setVariable("LABEL_NAME", gettext("Name")); $content->setVariable("LABEL_URL", gettext("URL")); $content->setVariable("LABEL_DESCRIPTION", gettext("Description")); $content->setVariable("LABEL_SAVE_CHANGES", gettext("Save changes")); $content->setVariable("LABEL_BACK", gettext("back")); $content->setVariable("LINK_BACK", PATH_URL . "weblog/index/" . $weblog->get_id() . "/"); $blogroll = $weblog->get_blogroll_list(); foreach ($blogroll as $link) { if (!$link instanceof \steam_docextern) { continue; } $content->setCurrentBlock("BLOCK_LINK"); $content->setVariable("LINK_URL", $link->get_url()); $content->setVariable("LINK_NAME", h($link->get_name())); $content->setVariable("LINK_DESC", h($link->get_attribute("OBJ_DESC"))); $content->setVariable("LABEL_EDIT", gettext("edit")); $content->setVariable("LINK_EDIT", PATH_URL . "docextern/" . $link->get_id() . "/edit/"); $content->setVariable("LINK_DELETE", PATH_URL . "docextern/" . $link->get_id() . "/delete/"); $content->setVariable("LABEL_DELETE", gettext("delete")); $content->parse("BLOCK_LINK"); } $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("Edit Blogroll"))); //$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; }
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"], $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); } } $podspace = $weblog->get_podspace(); if (!$podspace->check_access_write($user)) { throw new \Exception($user->get_name() . " has no write acces on podspace " . $podscace->get_id(), E_USER_RIGHTS); } if ($_SERVER["REQUEST_METHOD"] == "POST") { $values = $_POST["values"]; $problem = ""; $hint = ""; if (!empty($values["file_id"])) { // ALTER AN EXISTING DOCUMENT } else { // UPLOAD A NEW DOCUMENT if (!empty($values["desc"])) { $problem .= gettext("Please describe the file.") . " "; $hint .= ""; } $new_file = $podspace->upload("FILE_TO_UPLOAD"); } } $content = \Weblog::getInstance()->loadTemplate("weblog_podcast.template.html"); //$content = new HTML_TEMPLATE_IT(); //$content->loadTemplatefile( PATH_TEMPLATES . "weblog_podcast.template.html" ); $content->setVariable("GREETING", str_replace("%n", $_SESSION["LMS_USER"]->get_forename(), gettext("Hi %n!"))); if (empty($_GET["file"])) { $content->touchBlock("BLOCK_UPLOAD"); } $help_text = "<b>" . gettext("What is podcasting?") . "</b> " . gettext("Podcasting is the method of distributing multimedia files, such as audio programs, over the Internet using syndication feeds, for playback on mobile decices and personal computers."); $help_text .= "<br/><br/>" . gettext("The podcast is also available as a webfolder:") . " <a href=\"https://" . STEAM_SERVER . $podspace->get_path() . "\">WebDAV Mountpoint</a>"; $content->setVariable("HELP_TEXT", $help_text); $content->setVariable("YOUR_PODSCPACE_TEXT", gettext("Your Podspace")); $content->setVariable("UPLOAD_NEW_FILE_TEXT", gettext("Upload a multimedia file")); $content->setVariable("PODSPACE", $podspace->get_id()); $content->setVariable("LABEL_FILE", gettext("File")); $content->setVariable("LABEL_DESCRIPTION", gettext("Description")); $content->setVariable("LABEL_KEYWORDS", gettext("Keywords")); $content->setVariable("LABEL_SAVE_CHANGES", gettext("Save changes")); $content->setVariable("BACK_LINK", PATH_URL . "weblog/" . $weblog->get_id() . "/podspace/"); $content->setVariable("YOUR_PODSPACE_TEXT", gettext("Your Podspace")); $files_in_podspace = $podspace->get_inventory(CLASS_DOCUMENT); if (count($files_in_podspace) == 0) { $content->setCurrentBlock("BLOCK_EMPTY_PODSPACE"); $content->setVariable("NO_FILES_LABEL", gettext("no files found")); $content->parse("BLOCK_EMPTY_PODSPACE"); } foreach ($files_in_podspace as $file) { if (!$file instanceof \steam_document) { continue; } $content->setCurrentBlock("BLOCK_FILE"); $content->setVariable("FILE_NAME", h($file->get_name())); $content->setVariable("FILE_SIZE", get_formatted_filesize($file->get_content_size())); $content->setVariable("FILE_DESC", h($file->get_attribute("OBJ_DESC"))); $content->setVariable("LABEL_EDIT", gettext("edit")); $content->setVariable("LABEL_OR", gettext("or")); $content->setVariable("LABEL_DELETE", gettext("delete")); $content->parse("BLOCK_FILE"); } $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("Podcasting"))); /*$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; }