Skip to content
Snippets Groups Projects
Select Git revision
  • e3e7e1af2d31c2a4cfba63fb2e70f3a87cdaa467
  • 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

personal_notifications.js

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.
    ForumFavorite.php 1.25 KiB
    <?php
    /**
     * ForumFavorite.php - Add and remove favorite postings
     *
     * 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 ForumFavorite {
        
        /**
         * Set the topic denoted by the passed id as favorite for the 
         * currently logged in user
         * 
         * @param string $topic_id
         */
        static function set($topic_id) {
            $stmt = DBManager::get()->prepare("REPLACE INTO
                forum_favorites (topic_id, user_id)
                VALUES (?, ?)");
            $stmt->execute([$topic_id, $GLOBALS['user']->id]);
        }
    
        /**
         * Remove the topic denoted by the passed id as favorite for the 
         * currently logged in user
         * 
         * @param string $topic_id
         */
        static function remove($topic_id) {
            $stmt = DBManager::get()->prepare("DELETE FROM forum_favorites
                WHERE topic_id = ? AND user_id = ?");
            $stmt->execute([$topic_id, $GLOBALS['user']->id]);        
        }
    }