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

PluginAdministration.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.
    StudipController.php 29.71 KiB
    <?php
    /*
     * StudipController.php - studip controller base class
     * Copyright (c) 2009  Elmar Ludwig
     *
     * 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.
     */
    
    use DebugBar\DebugBar;
    use PhpOffice\PhpSpreadsheet\Spreadsheet;
    use PhpOffice\PhpSpreadsheet\Writer\Csv;
    use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
    
    /**
     * @property StudipResponse $response
     */
    abstract class StudipController extends Trails\Controller
    {
        use StudipControllerPropertiesTrait;
    
        protected $with_session = false; //do we need to have a session for this controller
        protected $allow_nobody = true; //should 'nobody' allowed for this controller or redirected to login?
        protected $_autobind = false;
    
        /**
         * @return false|void
         */
        public function before_filter(&$action, &$args)
        {
            $this->current_action = $action;
            // allow only "word" characters in arguments
            $this->validate_args($args);
    
            parent::before_filter($action, $args);
    
            if ($this->with_session) {
                # open session
                page_open([
                    'sess' => 'Seminar_Session',
                    'auth' => $this->allow_nobody ? 'Seminar_Default_Auth' : 'Seminar_Auth',
                    'perm' => 'Seminar_Perm',
                    'user' => 'Seminar_User'
                ]);
    
                // show login-screen, if authentication is "nobody"
                $GLOBALS['auth']->login_if((Request::get('again') || !$this->allow_nobody) && $GLOBALS['user']->id == 'nobody');
    
                // Setup flash instance
                $this->flash = Trails\Flash::instance();
    
                // set up user session
                include 'lib/seminar_open.php';
            }
    
            // Set generic attribute that indicates whether the request was sent
            // via ajax or not
            $this->via_ajax = Request::isXhr();
    
            # Set base layout
            #
            # If your controller needs another layout, overwrite your controller's
            # before filter:
            #
            #   class YourController extends AuthenticatedController {
            #     function before_filter(&$action, &$args) {
            #       parent::before_filter($action, $args);
            #       $this->set_layout("your_layout");