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

extern.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.
    extern.php 1.38 KiB
    <?php
    /**
     * extern.php - Controller to provide content to external pages.
     *
     * 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.
     *
     * @author      Peter Thienel <thienel@data-quest.de>
     * @license     http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
     * @category    Stud.IP
     * @since       5.4
     */
    
    class ExternController extends StudipController
    {
        protected $with_session = true;
    
        /**
         * Action shows rendered external page.
         *
         * @param string $config_id The id of the configuration of the external page to show.
         * @throws Trails_DoubleRenderError
         */
        public function index_action(string $config_id)
        {
            $config = ExternPageConfig::find($config_id);
            if (!$config) {
                $this->render_text(
                    Config::get()->EXTERN_PAGES_ERROR_MESSAGE
                );
                return;
            }
            try {
                $page = ExternPage::get($config);
                $page->setRequestParams();
            } catch (Exception $e) {
                $this->render_text(
                    Config::get()->EXTERN_PAGES_ERROR_MESSAGE . '<br>' . $e->getMessage()
                );
                return;
            }
    
            $this->render_text($page->toString());
        }
    
    }