Select Git revision
PluginAdministration.php
Forked from
Stud.IP / Stud.IP
Source project has a limited visibility.
-
Jan-Hendrik Willms authored
Closes #4077 Merge request studip/studip!2920
Jan-Hendrik Willms authoredCloses #4077 Merge request studip/studip!2920
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");