Skip to content
Snippets Groups Projects
Select Git revision
  • 4136554f563b8ca892cdf811d3eb6db468203b94
  • main default protected
  • studip-rector
  • ci-opt
  • course-members-export-as-word
  • data-vue-app
  • pipeline-improvements
  • webpack-optimizations
  • rector
  • icon-renewal
  • http-client-and-factories
  • jsonapi-atomic-operations
  • vueify-messages
  • tic-2341
  • 135-translatable-study-areas
  • extensible-sorm-action-parameters
  • sorm-configuration-trait
  • jsonapi-mvv-routes
  • docblocks-for-magic-methods
19 results

EditableList.vue

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 52.65 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