本文整理汇总了PHP中lms_steam::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP lms_steam::delete方法的具体用法?PHP lms_steam::delete怎么用?PHP lms_steam::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lms_steam
的用法示例。
在下文中一共展示了lms_steam::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
include_once "../etc/koala.conf.php";
include_once PATH_LIB . "steam_handling.inc.php";
include_once PATH_LIB . "format_handling.inc.php";
$portal = lms_portal::get_instance();
$portal->initialize(GUEST_NOT_ALLOWED);
$message = steam_factory::get_object($STEAM->get_id(), $_GET["id"]);
if (empty($_GET["id"]) || !$message) {
include "bad_link.php";
exit;
}
$is_sent = isset($_GET['sent']) && $_GET['sent'] ? TRUE : FALSE;
if (isset($_REQUEST["reply"])) {
header("Location: " . PATH_URL . "messages_write.php?reply_to=" . $_GET["id"]);
} elseif (isset($_REQUEST["delete"])) {
$trashbin = $GLOBALS["STEAM"]->get_current_steam_user();
lms_steam::delete($message);
$_SESSION["confirmation"] = gettext("1 message deleted.");
header("Location: " . PATH_URL . "messages.php");
exit;
}
$user = lms_steam::get_current_user();
$cache = get_cache_function($user->get_name(), 600);
$cache->drop("lms_steam::user_count_unread_mails", $user->get_name());
$portal->set_page_title(gettext("Message"));
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "messages_read.template.html");
$mail_headers = $message->get_attribute("MAIL_MIMEHEADERS");
if (!is_array($mail_headers)) {
$mail_headers = array();
}
if (array_key_exists("X-Steam-Group", $mail_headers)) {
示例2: frameResponse
public function frameResponse(\FrameResponseObject $frameResponseObject)
{
$group_id = $this->params[0];
$user = \lms_steam::get_current_user();
try {
$steam_group = !empty($group_id) ? \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $group_id) : FALSE;
} catch (Exception $ex) {
include "bad_link.php";
exit;
}
$group_is_private = FALSE;
if ($steam_group && is_object($steam_group)) {
switch ((string) $steam_group->get_attribute("OBJ_TYPE")) {
case "course":
$group = new koala_group_course($steam_group);
// TODO: Passt der backlink?
$backlink = PATH_URL . SEMESTER_URL . "/" . $group->get_semester()->get_name() . "/" . h($group->get_name()) . "/";
break;
default:
$group = new \koala_group_default($steam_group);
// TODO: Passt der backlink?
$backlink = PATH_URL . "groups/" . $group->get_id() . "/";
// Determine if group is public or private
$parent = $group->get_parent_group();
if ($parent->get_id() == STEAM_PRIVATE_GROUP) {
$group_is_private = TRUE;
}
break;
}
}
if ($group_is_private) {
if (!$steam_group->is_member($user) && !\lms_steam::is_koala_admin($user)) {
throw new Exception(gettext("You have no rights to access this group"), E_USER_RIGHTS);
}
}
if (!$steam_group->check_access_write($user)) {
throw new Exception(str_replace("%USER", $user->get_login(), sr_replace("%GROUP", $group->get_id(), gettext("Access denied: User %USER has no right to delete the group %GROUP"))), E_USER_RIGHTS);
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$values = $_POST["values"];
$env = $steam_group->get_environment();
// TODO: Passt der link?
$upper_link = PATH_URL . "groups/" . (is_object($env) ? "?cat=" . $env->get_id() : "");
$group_name = $group->get_display_name();
$members = $group->get_members();
$inventory = $group->get_workroom()->get_inventory_raw();
$deleted = TRUE;
foreach ($inventory as $object) {
if (!$object instanceof \steam_user) {
try {
\lms_steam::delete($object);
} catch (Exception $ex3) {
\logging::write_log(LOG_DEBUGLOG, "groups_delete:error deleting object from group workroom\t" . $login . " \t" . $group->get_display_name() . " \t" . $steam_group->get_id() . " \t" . $object->get_id());
}
}
}
if ($steam_group->delete()) {
$user->get_attributes(array(OBJ_NAME, USER_FIRSTNAME, USER_FULLNAME));
foreach ($members as $member) {
$cache = get_cache_function($member->get_name());
$cache->drop("lms_steam::user_get_groups", $member->get_name(), TRUE);
$cache->drop("lms_steam::user_get_groups", $member->get_name(), FALSE);
$cache->drop("lms_steam::user_get_profile", $member->get_name());
$cache->drop("lms_portal::get_menu_html", $member->get_name(), TRUE);
}
$cache = get_cache_function($steam_group->get_id());
$cache->drop("lms_steam::group_get_members", $steam_group->get_id());
foreach ($members as $member) {
\lms_steam::mail($member, $user, PLATFORM_NAME . ": " . str_replace("%NAME", h($group_name), gettext("Group %NAME has been deleted.")), str_replace("%USER", $user->get_name() . " (" . $user->get_attribute(USER_FIRSTNAME) . " " . $user->get_attribute(USER_FULLNAME) . ")", str_replace("%NAME", h($group_name), gettext("The group '%NAME' has been deleted from he koaLA System by %USER."))) . "\n\n-- \n" . str_replace("%NAME", h($group_name), gettext("This system generated notification message was sent to you as a former member of the deleted group \"%NAME\"")));
}
$_SESSION["confirmation"] = str_replace("%NAME", h($group_name), gettext("The group '%NAME' has been deleted. A notification has been sent to former members."));
header("Location: " . $upper_link);
exit;
} else {
throw new Exception("Deletion of group failed");
}
}
$content = \Group::getInstance()->loadTemplate("group_delete.template.html");
$content->setVariable("FORM_ACTION", "");
$content->setVariable("LABEL_ARE_YOU_SURE", gettext("Are you sure?"));
$content->setVariable("INFO_DELETE_GROUP", str_replace("%GROUP_NAME", h($group->get_name()), gettext("You are going to delete '%GROUP_NAME'.")) . "<br />" . gettext("All data of this group will be removed from the system including weblogs, wikis, forums and documents. All members of this group will be notified about the deletion automatically.") . "<br /><br /><strong>" . gettext("The deletion process may take several minutes.")) . "</strong>";
$content->setVariable("LABEL_DELETE_IT", gettext("Yes, delete this group"));
$content->setVariable("DELETE_BACK_LINK", $_SERVER["HTTP_REFERER"]);
$content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
$content->setVariable("LABEL_RETURN", gettext("back"));
$frameResponseObject->setTitle("Group");
$rawHtml = new \Widgets\RawHtml();
$rawHtml->setHtml($content->get());
$frameResponseObject->addWidget($rawHtml);
return $frameResponseObject;
}
示例3: frameResponse
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);
//.........这里部分代码省略.........
示例4: execute
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;
}
}
}
示例5: header
<?php
// no direct call
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);
示例6: execute
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]);
$id = $this->params[1];
if ($id != null) {
$doc = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $id);
$parent_wiki = $doc->get_attribute("OBJ_VERSIONOF");
$all_versions = $parent_wiki->get_attribute("DOC_VERSIONS");
//user authorized ?
$current_user = \lms_steam::get_current_user();
$author = $doc->get_attribute("DOC_USER_MODIFIED");
if ($current_user->get_name() !== $author->get_attribute("OBJ_NAME")) {
//TODO: Error Message
header("Location: " . PATH_URL . "wiki/viewentry/" . $parent_wiki->get_id() . "/versions/");
exit;
}
$keys = array_keys($all_versions);
sort($keys);
$new_array = array();
$new_key = 1;
foreach ($keys as $key) {
$version = $all_versions[$key];
if (!$version instanceof \steam_document || $version->get_id() == $doc->get_id()) {
continue;
}
$version->set_attribute("DOC_VERSION", $new_key);
$new_array[$new_key] = $version;
$new_key++;
}
if (empty($new_array)) {
$parent_wiki->set_attribute("DOC_VERSIONS", 0);
$parent_wiki->set_attribute("DOC_VERSION", 1);
} else {
$parent_wiki->set_attribute("DOC_VERSIONS", $new_array);
$parent_wiki->set_attribute("DOC_VERSION", count($new_array) + 1);
}
\lms_steam::delete($doc);
// clean wiki cache (not used by wiki)
$cache = get_cache_function($doc->get_id(), 600);
$cache->clean("lms_wiki::get_items", $doc->get_id());
$_SESSION["confirmation"] = gettext("Wiki entry deleted sucessfully");
header("Location: " . PATH_URL . "wiki/versionoverview/" . $parent_wiki->get_id());
die;
}
}
示例7: Exception
if (!$container->check_access_write($user)) {
throw new Exception($user->get_login() . ": no right to delete " . $container->get_id(), E_USER_RIGHTS);
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$values = $_POST["values"];
$container_name = $container->get_name();
$environment = $container->get_environment();
if (is_object($environment) && $environment instanceof steam_container) {
$koala_environment = new koala_container($environment);
$upper_link = $koala_environment->get_url();
} else {
$upper_link = lms_steam::get_link_to_root($container);
$upper_link["link"];
}
if (lms_steam::delete($container)) {
$_SESSION["confirmation"] = str_replace("%NAME", h($container_name), gettext("The folder '%NAME' has been deleted."));
header("Location: " . $upper_link);
exit;
} else {
throw new Exception("Cannot delete container");
}
}
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "container_delete.template.html");
$content->setVariable("FORM_ACTION", "");
$content->setVariable("LABEL_ARE_YOU_SURE", gettext("Are you sure?"));
$content->setVariable("INFO_DELETE_CONTAINER", str_replace("%CONTAINER_NAME", h($container->get_name()), gettext("You are going to delete '%CONTAINER_NAME'.")));
$content->setVariable("LABEL_DELETE_IT", gettext("Yes, delete this container"));
$content->setVariable("DELETE_BACK_LINK", $_SERVER["HTTP_REFERER"]);
$content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
示例8: catch
<?php
require_once "../etc/koala.conf.php";
$portal = lms_portal::get_instance();
$portal->initialize(GUEST_NOT_ALLOWED);
$user = lms_steam::get_current_user();
if (!lms_steam::is_steam_admin($user) && !lms_steam::is_semester_admin($current_semester, $user) && !$course->is_admin($user)) {
include "bad_link.php";
exit;
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if ($_POST["id"] == $unit->get_id()) {
try {
lms_steam::delete($unit);
} catch (Exception $exception) {
$problems = $exception->get_message();
}
}
if (empty($problems)) {
$_SESSION["confirmation"] = str_replace("%NAME", $unit_name, gettext("Unit %NAME deleted."));
header("Location: " . PATH_URL . SEMESTER_URL . "/" . $course->get_semester()->get_name() . "/" . $course->get_name() . "/units/");
exit;
} else {
$portal->set_problem_description($problems, $hints);
}
}
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "courses_unit_delete.template.html");
$content->setVariable("UNIT_ID", $unit->get_id());
$content->setVariable("BACK_LINK", $backlink);
$content->setVariable("INFO_TEXT", gettext("If you go on , this unit will be deleted."));
示例9: frameResponse
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!"));
//.........这里部分代码省略.........
示例10: header
<?php
$user = lms_steam::get_current_user();
if ($_SERVER["REQUEST_METHOD"] == "POST" && $docextern->check_access_write($user)) {
$values = $_POST["values"];
if ($values["delete"]) {
lms_steam::delete($docextern);
header("Location: " . $values["return_to"]);
exit;
}
}
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "docextern_delete.template.html");
if ($docextern->check_access_write($user)) {
$content->setVariable("LABEL_ARE_YOU_SURE", gettext("Are you sure you want to delete this URL?"));
$content->setVariable("DELETE_BACK_LINK", $_SERVER["HTTP_REFERER"]);
$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 URL!"));
}
$content->setVariable("TEXT_COMMENT", h($docextern->get_attribute("OBJ_DESC")));
$creator = $docextern->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($docextern->get_attribute("OBJ_CREATION_TIME")));
$content->setVariable("ICON_SRC", PATH_URL . "get_document.php?id=" . $creator_data["OBJ_ICON"]->get_id());
$portal->set_page_main("Delete an URL", $content->get(), "");
示例11: gettext
} else {
include "bad_link.php";
}
exit;
break;
case $path[0] == "delete":
// Delete a wiki document
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/" . $wiki_container->get_id() . "/");
} else {
$wiki_name = h(substr($wiki_doc->get_name(), 0, -5));
$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'));
示例12: execute
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);
//.........这里部分代码省略.........
示例13: execute
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
$object = $wiki_container;
$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 wiki '%NAME' has been deleted."));
$workroom = $object->get_environment();
\lms_steam::delete($object);
$wid = $object->get_id();
// Clean Cache for the deleted wiki
require_once "Cache/Lite.php";
$cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
$cache = get_cache_function($wid, 600);
$cache->drop("lms_steam::get_items", $wid);
// Handle Related Cache-Data
require_once "Cache/Lite.php";
$cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
$cache->clean($wid);
// clean wiki cache (not used by wiki)
$fcache = get_cache_function($object->get_id(), 600);
$fcache->drop("lms_wiki::get_items", $object->get_id());
// 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_CONTAINER | CLASS_ROOM, array("OBJ_TYPE", "WIKI_LANGUAGE"));
$cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
// clean rsscache
$rcache = get_cache_function("rss", 600);
$feedlink = PATH_URL . "services/feeds/wiki_public.php?id=" . $wid;
$rcache->drop("lms_rss::get_items", $feedlink);
}
header("Location: " . $values["return_to"]);
exit;
}
}
$content = \Wiki::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 wiki '%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 wiki!"));
}
$content->setVariable("TEXT_INFORMATION", gettext("The Wiki 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($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("name" => gettext("Delete wiki"), "link" => "")) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("name" => gettext("Delete wiki"), "link" => "")));
$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();*/
}
示例14: delete
public function delete()
{
lms_steam::delete($this->steam_object);
}
示例15: Exception
//TODO: check for trashbin and then check for move permission on the container in which the document is
if (!$document->check_access_write($user)) {
throw new Exception($user->get_login() . ": no right to delete " . $document->get_id(), E_USER_RIGHTS);
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$values = $_POST["values"];
$doc_name = $document->get_name();
$env = $document->get_environment();
if (is_object($env) && is_object($koala_container = koala_object::get_koala_object($env))) {
$backlink = $koala_container->get_url();
}
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"));