/** * fill the passed postings with additional data * * @param array $postings * @return array */ static function parseEntries($postings) { $posting_list = array(); // retrieve the postings foreach ($postings as $data) { // we throw away all formatting stuff, tags, etc, leaving the important bit of information $desc_short = ForumEntry::br2space(ForumEntry::killFormat(strip_tags($data['content']))); if (strlen($desc_short) > ForumEntry::THREAD_PREVIEW_LENGTH + 2) { $desc_short = substr($desc_short, 0, ForumEntry::THREAD_PREVIEW_LENGTH) . '...'; } else { $desc_short = $desc_short; } $posting_list[$data['topic_id']] = array('author' => $data['author'], 'topic_id' => $data['topic_id'], 'name' => formatReady($data['name']), 'name_raw' => $data['name'], 'content' => ForumEntry::getContentAsHtml($data['content'], $data['anonymous']), 'content_raw' => ForumEntry::killEdit($data['content']), 'content_short' => $desc_short, 'chdate' => $data['chdate'], 'mkdate' => $data['mkdate'], 'user_id' => $data['user_id'], 'raw_title' => $data['name'], 'raw_description' => ForumEntry::killEdit($data['content']), 'fav' => $data['fav'] == 'fav', 'depth' => $data['depth'], 'anonymous' => $data['anonymous'], 'closed' => $data['closed'], 'sticky' => $data['sticky'], 'seminar_id' => $data['seminar_id']); } // retrieve the postings return $posting_list; }
public function convertEntry($raw) { $entry = array(); foreach (words("topic_id mkdate chdate anonymous depth") as $key) { $entry[$key] = $raw[$key]; } $entry['subject'] = $raw['name']; $entry['user'] = $this->urlf('/user/%s', array($raw['user_id'])); $entry['course'] = $this->urlf('/course/%s', array($raw['seminar_id'])); $entry['content_html'] = \ForumEntry::getContentAsHtml($raw['content']); $entry['content'] = \ForumEntry::killEdit($raw['content']); return $entry; }
/** * this action renders a preview of the submitted text */ function preview_action() { if (Request::isXhr()) { $this->set_content_type('text/html; charset=UTF-8'); $this->render_text(studip_utf8encode(formatReady(transformBeforeSave(studip_utf8decode(Request::get('posting')))))); } else { $this->render_text(ForumEntry::getContentAsHtml(transformBeforeSave(Request::get('posting')))); } }