Skip to content
Snippets Groups Projects
Select Git revision
  • e343ab9eed1bc44a33f45967d994aaab6b926438
  • main default protected
  • step-3263
  • feature/plugins-cli
  • feature/vite
  • step-2484-peerreview
  • biest/issue-5051
  • tests/simplify-jsonapi-tests
  • fix/typo-in-1a70031
  • feature/broadcasting
  • database-seeders-and-factories
  • feature/peer-review-2
  • feature-feedback-jsonapi
  • feature/peerreview
  • feature/balloon-plus
  • feature/stock-images-unsplash
  • tic-2588
  • 5.0
  • 5.2
  • biest/unlock-blocks
  • biest-1514
21 results

object.inc.php

Blame
  • Forked from Stud.IP / Stud.IP
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    ForumEntry.php 53.21 KiB
    <?php
    /**
     * ForumEntry.php - Allows the retrieval and handling of forum-entrys
     *
     * 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 3 of
     * the License, or (at your option) any later version.
     *
     * @author      Till Glöggler <tgloeggl@uos.de>
     * @license     http://www.gnu.org/licenses/gpl-3.0.html GPL version 3
     * @category    Stud.IP
     */
    
    class ForumEntry  implements PrivacyObject
    {
        const WITH_CHILDS = true;
        const WITHOUT_CHILDS = false;
        const THREAD_PREVIEW_LENGTH = 100;
        const POSTINGS_PER_PAGE = 10;
        const FEED_POSTINGS = 100;
    
    
        /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         * H   E   L   P   E   R   -   F   U   N   C   T   I   O   N   S *
         * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    
        /**
         * is used for posting-preview. replaces all newlines with spaces
         *
         * @param string $text the text to work on
         * @returns string
         */
        public static function br2space($text)
        {
            return str_replace("\n", ' ', str_replace("\r", '', $text));
        }
    
        /**
         * remove the edit-html from a posting
         *
         * @param string $description the posting-content
         * @return string the content stripped by the edit-mark
         */
        public static function killEdit($description)
        {
            // wurde schon mal editiert
            if (preg_match('/^(.*)(<admin_msg.*?)$/s', $description, $match)) {
                return $match[1];
            }
            return $description;
        }
    
        /**
         * add the edit-html to a posting
         *
         * @param string $description the posting-content
         * @return string the content with the edit-mark
         */
        public static function appendEdit($description)
        {
            $edit = "<admin_msg autor=\"" . addslashes(get_fullname()) . "\" chdate=\"" . time() . "\">";
            return $description . $edit;
        }
    
        /**
         * convert the edit-html to raw text
         *
         * @param string $description the posting-content
         * @return string the content with the raw text version of the edit-mark