public function __construct() { global $perm; parent::__construct(); if (UpdateInformation::isCollecting()) { $data = Request::getArray("page_info"); if (stripos(Request::get("page"), "plugins.php/blubber") !== false) { $output = array(); $context_id = $data['Blubber']['context_id']; $stream = $data['Blubber']['stream']; $last_check = $data['Blubber']['last_check'] ? $data['Blubber']['last_check'] : time() - 5 * 60; $parameter = array('since' => $last_check); if ($stream === "thread") { $parameter['thread'] = $context_id; } if ($stream === "course") { $parameter['seminar_id'] = $context_id; } if ($stream === "profile") { $parameter['user_id'] = $context_id; } if ($data['Blubber']['search']) { $parameter['search'] = $data['Blubber']['search']; } $new_postings = ForumPosting::getPostings($parameter); $factory = new Flexi_TemplateFactory($this->getPluginPath() . "/views"); foreach ($new_postings as $new_posting) { if ($new_posting['root_id'] === $new_posting['topic_id']) { $thread = $new_posting; $template = $factory->open("forum/thread.php"); $template->set_attribute('thread', $new_posting); } else { $thread = new ForumPosting($new_posting['root_id']); $template = $factory->open("forum/comment.php"); $template->set_attribute('posting', $new_posting); } ForumPosting::$course_hashes = $thread['user_id'] !== $thread['Seminar_id'] ? $thread['Seminar_id'] : false; $template->set_attribute("course_id", $data['Blubber']['seminar_id']); $output['postings'][] = array('posting_id' => $new_posting['topic_id'], 'mkdate' => $new_posting['mkdate'], 'root_id' => $new_posting['root_id'], 'content' => $template->render()); } UpdateInformation::setInformation("Blubber.getNewPosts", $output); //Events-Queue: $db = DBManager::get(); $events = $db->query("SELECT event_type, item_id " . "FROM blubber_events_queue " . "WHERE mkdate >= " . $db->quote($last_check) . " " . "ORDER BY mkdate ASC " . "")->fetchAll(PDO::FETCH_ASSOC); UpdateInformation::setInformation("Blubber.blubberEvents", $events); $db->exec("DELETE FROM blubber_events_queue " . "WHERE mkdate < UNIX_TIMESTAMP() - 60 * 60 * 6 " . ""); } } if (Navigation::hasItem("/course") && $this->isActivated() && version_compare($GLOBALS['SOFTWARE_VERSION'], "2.4") <= 0) { $tab = new AutoNavigation($this->getDisplayTitle(), PluginEngine::getLink($this, array(), "forum/forum")); $tab->setImage($this->getPluginURL() . "/assets/images/blubber_white.png"); Navigation::addItem("/course/blubberforum", $tab); } if (Navigation::hasItem("/community")) { $nav = new AutoNavigation($this->getDisplayTitle(), PluginEngine::getURL($this, array(), "forum/globalstream")); Navigation::insertItem("/community/blubber", $nav, "online"); Navigation::getItem("/community")->setURL(PluginEngine::getURL($this, array(), "forum/globalstream")); } if (Navigation::hasItem("/profile")) { $nav = new AutoNavigation(_("Blubber"), PluginEngine::getURL($this, array('user_id' => get_userid(Request::get("username"))), "forum/profile")); Navigation::addItem("/profile/blubber", $nav); } }
public function thread_action($thread_id) { PageLayout::addHeadElement("script", array('src' => $this->assets_url . "/javascripts/autoresize.jquery.min.js"), ""); PageLayout::addHeadElement("script", array('src' => $this->assets_url . "/javascripts/blubberforum.js"), ""); PageLayout::addHeadElement("script", array('src' => $this->assets_url . "/javascripts/formdata.js"), ""); $this->thread = new ForumPosting($thread_id); if ($this->thread['context_type'] === "course") { PageLayout::setTitle($GLOBALS['SessSemName']["header_line"] . " - " . $this->plugin->getDisplayTitle()); } elseif ($this->thread['context_type'] === "public") { PageLayout::setTitle(get_fullname($this->thread['user_id']) . " - Blubber"); } elseif ($this->thread['context_type'] === "private") { PageLayout::setTitle(_("Privater Blubber")); } if ($this->thread['context_type'] === "course") { Navigation::getItem("/course/blubberforum")->setImage($this->plugin->getPluginURL() . "/assets/images/blubber.png"); Navigation::activateItem('/course/blubberforum'); } elseif ($this->thread['context_type'] === "public") { Navigation::activateItem('/profile/blubber'); } else { Navigation::activateItem('/community/blubber'); } $this->course_id = $_SESSION['SessionSeminar']; $this->single_thread = true; ForumPosting::$course_hashes = $thread['user_id'] !== $thread['Seminar_id'] ? $thread['Seminar_id'] : false; }
<?php /* * Copyright (c) 2012 Rasmus Fuhse <*****@*****.**> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. */ $last_visit = object_get_visit($_SESSION['SessionSeminar'], "forum"); ForumPosting::$course_hashes = $thread['context_type'] === "course" ? $thread['Seminar_id'] : false; $related_users = $thread['context_type'] === "private" ? $thread->getRelatedUsers() : array(); $author = $thread->getUser(); $author_name = $author->getName(); $author_name or $author_name = $posting['author']; ?> <? if (@$single_thread): ?> <input type="hidden" id="base_url" value="plugins.php/blubber/forum/"> <input type="hidden" id="context_id" value="<?php echo htmlReady($thread->getId()); ?> "> <input type="hidden" id="stream" value="thread"> <input type="hidden" id="last_check" value="<?php echo time(); ?> "> <input type="hidden" id="user_id" value="<?php echo htmlReady($GLOBALS['user']->id); ?>