public function reset()
 {
     Application::getInstance()->setTemplate('unify_login');
     $person = User::loadByToken($this->request->token);
     if ($person == null) {
         FlashMessage::danger("Dieses Token befindet sich nicht in der Datenbank.");
         Application::getCurrentResponse()->redirectToFrontpage();
     }
 }
 /**
  * Setzt die Informationen der geöffneten Seite den Request und Response
  * Objekten.
  *
  * @param Request $request
  * @param Page $page
  */
 public function setCurrentPage(&$request, $page)
 {
     Profiler::startSection('Routing.setCurrentPage');
     Application::getInstance()->setCurrentPage($page);
     $response = Application::getCurrentResponse();
     $request->module = $page->pa_module;
     $request->action = $page->pa_action;
     $request->innerTemplate = $page->pa_innertemplate;
     $request->parseParameter($page->pa_parameter);
     $this->generateBreadcrumbsForPage($page);
     Profiler::endSection('Routing.setCurrentPage');
 }
Exemplo n.º 3
0
 /**
  * Führt einen 301 HTTP Redirect aus und beendet das Script sofort
  * @param string $newUrl
  */
 public static function redirect($newUrl)
 {
     // FlashMessages in Session an neue Seite übertragen übertragen
     if (count(Application::getInstance()->flashMessages) > 0) {
         $_SESSION['flashMessages'] = Application::getInstance()->flashMessages;
     }
     if (!headers_sent()) {
         header('Location: ' . $newUrl);
         die;
     } else {
         throw new \RuntimeException("Redirect nach {$newUrl} kann nicht ausgeführt werden, da die Header bereits\n                gesendet wurden.");
     }
 }
 public function init()
 {
     Javascript::requireLibrary('bootstrap');
     $this->defaultSkinFile = __DIR__ . '/TabControl.skin';
     if (isset(Application::getInstance()->getRequest()->initPanel)) {
         $this->initPanel = Application::getInstance()->getRequest()->initPanel;
     }
     $key = 'tab_active_' . $this->id;
     if (isset(Application::getInstance()->getRequest()->{$key}) && Application::getInstance()->getRequest()->{$key} != '') {
         $this->activePanel = Application::getInstance()->getRequest()->{$key};
     } else {
         if ($this->initPanel < 0) {
             $this->initPanel = 0;
         }
     }
 }
 /**
  * @covers \NewFrontiers\Framework\Output\FlashMessage::__construct
  * @covers \NewFrontiers\Framework\Output\FlashMessage::toHtml
  * @covers \NewFrontiers\Framework\Output\FlashMessage::danger
  * @covers \NewFrontiers\Framework\Output\FlashMessage::info
  * @covers \NewFrontiers\Framework\Output\FlashMessage::success
  * @covers \NewFrontiers\Framework\Output\FlashMessage::warning
  */
 public function testDefaultMessages()
 {
     Application::getInstance()->flashMessages = [];
     FlashMessage::danger("danger-Meldung");
     $danger = end(Application::getInstance()->flashMessages);
     FlashMessage::info("info-Meldung");
     $info = end(Application::getInstance()->flashMessages);
     FlashMessage::success("success-Meldung");
     $success = end(Application::getInstance()->flashMessages);
     FlashMessage::warning("warning-Meldung");
     $warning = end(Application::getInstance()->flashMessages);
     //At least the message should appear in the result
     $this->assertContains("danger-Meldung", $danger->toHtml());
     $this->assertContains("info-Meldung", $info->toHtml());
     $this->assertContains("success-Meldung", $success->toHtml());
     $this->assertContains("warning-Meldung", $warning->toHtml());
 }
 /**
  * Rahmen zum Ausführen einer Funktion. Konkrete Ausführeung wird
  * von abstrakter Methode executeAction ausgeführt
  * @param $request
  * @return Response
  * @throws Exception
  */
 public function execute($request)
 {
     // Der Response wird direkt am Anfang erzeugt und auch in der Application-Klasse
     // hinterlegt. Das muss aus Gründen der Abwärtskompatibilität sein. In den Controller
     // Methiden wird oft auf Application::currentResponse zurückgegriffen. Das muss an
     // dieser Stelle also gefüllt sein.
     Logging::info("Ausführen von [{$this->request->module}:{$this->request->action}]");
     Profiler::startSection($this->request->module . '.' . $this->request->action);
     $this->request = $request;
     $this->response = new Response();
     Application::getInstance()->setResponse($this->response);
     $this->currentAction = $this->module->getAction($this->request->action);
     // Abbrechen, wenn Aktion nicht gefunden werden konnte
     if ($this->currentAction === null) {
         throw new \DomainException("Aktion '{$this->request->action}' in Modul '{$this->request->module}' nicht gefunden");
     } else {
         // Verhindern, dass von einem Angreifer eine beliebige Seite aufgerufen werden
         // kann
         $this->request->view = null;
         // Response mit den Standard-Daten füllen
         $this->response->setContent($this->currentAction->getDefaultNext($this));
         $result = $this->innerExecute();
         if ($result !== null) {
             $this->response = $result;
         }
         // Jetzt kann sich unter Umständen der View geändert haben
         if ($this->request->view !== null) {
             Logging::warning('anderen View laden');
             $this->response->setContent($this->module->loadView($this->request->view, $this));
         }
         // Überschreiben der eigentlichen Aktion durch eine, die bei der Ausführung der Funktion
         // gesetzt wurde
         if ($this->request->action !== $this->currentAction->name) {
             Logging::warning('Andere Action ausführen');
             $this->response->setContent($this->module->getAction($this->request->action));
         }
         Profiler::endSection($this->request->module . '.' . $this->request->action);
         return $this->response;
     }
 }
 /**
  * Fügt dem Container für die anzuzeigenden FlashMessages eine Message hinzu
  *
  * @param $message FlashMessage
  */
 public static function addFlashMessage(FlashMessage $message)
 {
     Application::getInstance()->flashMessages[] = $message;
 }
 public function search()
 {
     // TODO: Was macht das denn hier?
     Application::getInstance()->setCurrentPage(new Page(98));
     $sql = "select\n                pa_bezeichnung, pa_link, te_text \n              from cmsartikel\n                join texte on te_element = CONCAT('cmsartikel.', ca_id, '.intro') and te_sprache = 1\n                join pages on pa_parameter = CONCAT('id=', ca_id)\n \n              where upper(te_text) like upper(:suchbegriff)";
     $db = Database::getInstance();
     $db->query($sql, array('suchbegriff' => '%' . $this->request->suchbegriff . '%'));
     $this->hits = array();
     while ($row = $db->fetch()) {
         $this->hits[] = array('page' => $row['pa_bezeichnung'], 'link' => $row['pa_link'], 'text' => $this->getShortText($row['te_text']));
     }
 }
Exemplo n.º 9
0
echo Application::getInstance()->response->getMetadata()->getHeading();
?>
</h2>
                <?php 
$bc = new BreadcrumbControl(null, 'bc');
echo $bc->toHtml();
?>
            </div>
        </div>


        <!-- Content -->
        <div class="wrapper wrapper-content animated fadeInRight">

            <?php 
Application::getInstance()->displayMain();
?>

        </div>


        <!-- Footer -->
        <div class="footer">
            <div class="pull-right">
                <!--<a href="http://www.apiida.de" target="_blank">www.apiida.de</a>-->
            </div>
            <div>
                <!--Made with love by <strong>Apiida</strong>-->
            </div>
        </div>
Exemplo n.º 10
0
<?php

use NewFrontiers\Framework\Core\Application;
include 'bootstrap.php';
include \Nostromo\Contracts\Configuration\Environment::get()->srcDir . '/Bootstrap.php';
Application::getInstance()->startSession();
include \Nostromo\Contracts\Configuration\Environment::get()->srcDir . '/InitApplication.php';
// Wenn nichts übertragen wird ist es ein Grid
if (!isset($_POST['control'])) {
    $var = unserialize(base64_decode($_POST['vars']));
    $sort = unserialize(base64_decode($_POST['sort']));
    $grid = new NewFrontiers\Controls\DataControls\GridControl(null, 'grid');
    $grid->loadFromConfigArray($var, $sort);
    if (isset($_POST['page'])) {
        $grid->setCurPage($_POST['page']);
    }
    if (isset($_POST['sorting'])) {
        $grid->setCurSorting($_POST['sorting']);
    }
    $grid->ajax = true;
    echo $grid->toHtml();
}
 public function requestLink(Request $request, $keepOldRequestData = false)
 {
     // Legacy... Kann entfernt werden, wenn alles überarbeitet wurde
     if (isset($request->message)) {
         FlashMessage::info($request->message);
     }
     $requestArray = array();
     if ($keepOldRequestData) {
         $requestArray = $request->getArray();
     }
     if (count(Application::getInstance()->flashMessages) > 0) {
         $messages = serialize(Application::getInstance()->flashMessages);
         $requestArray['messages'] = base64_encode($messages);
     }
     return $this->appLink($request->module, $request->action, $requestArray, $request->hash);
 }
Exemplo n.º 12
0
    exit;
}
// Kondiguration anpassen
$config = file_get_contents(__DIR__ . '/site/Configuration.xml.dist');
$config = str_replace('BASEURL', $_POST['baseurl'], $config);
$config = str_replace('NAMESPACE', $_POST['namespace'], $config);
$config = str_replace('DATABASE_HOST', $_POST['database_host'], $config);
$config = str_replace('DATABASE_SCHEMA', $_POST['database_schema'], $config);
$config = str_replace('DATABASE_USER', $_POST['database_user'], $config);
$config = str_replace('DATABASE_PASSWORD', $_POST['database_pass'], $config);
file_put_contents(__DIR__ . '/site/Configuration.xml', $config);
// Uuund los geht's
include __DIR__ . '/bootstrap.php';
ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);
\NewFrontiers\Framework\Core\Application::getInstance();
include \Nostromo\Contracts\Configuration\Environment::get()->srcDir . '/Bootstrap.php';
$siteInstaller = new \NewFrontiers\Modules\Site\SiteInstaller();
$cmsInstaller = new \NewFrontiers\Modules\Cms\CmsInstaller();
$userInstaller = new \NewFrontiers\Modules\User\UserInstaller();
$siteInstaller->migrateDatabase();
$cmsInstaller->migrateDatabase();
$userInstaller->migrateDatabase();
$siteInstaller->install();
$cmsInstaller->install();
$userInstaller->install();
$installer = new \NewFrontiers\Modules\ModView\ModViewInstaller();
$installer->install();
$installer = new \NewFrontiers\Modules\Medien\MedienInstaller();
$installer->install();
$installer = new \NewFrontiers\Modules\DefaultMod\DefaultModInstaller();