public function stopDebug()
 {
     if (Debug::isEnabled()) {
         Debug::getInstance()->stop();
         FlashMessage::success('Debug Modus deaktiviert');
         Response::redirectToFrontpage();
     }
 }
 public function deleteHistorie()
 {
     $this->historie = new Historie($this->request->id);
     if ($this->historie->delete()) {
         FlashMessage::success(Strings::GELOESCHT);
     } else {
         FlashMessage::danger(Strings::NICHT_GELOESCHT);
     }
 }
 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);
 }
 /**
  * @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());
 }
 public function generateSitemap()
 {
     $builder = new SitemapBuilder();
     $builder->buildSitemap();
     FlashMessage::success('Sitemap wurde generiert');
 }
 public function aktivierungslinkSenden()
 {
     $this->user = new User($this->request->id);
     if ($this->user->val('us_aktiv')) {
         FlashMessage::warning('Der Benutzer ist bereits aktiv. Es wurde keine Mail versendet');
         return;
     }
     $activationLink = Routing::appLink('User', 'activateUser', ['hash' => $this->user->generateHash()]);
     UserMailer::activate($this->user, 'Ihr Benutzerkonto', $activationLink);
     FlashMessage::success('Aktivierungslink wurde versendet');
 }
 public function endEditArtikel()
 {
     $this->artikel = new CmsArtikel($this->request->id);
     $this->artikel->save($this->request);
     Text::saveArray($this->artikel->getElementId() . '.titel', $this->request->titel);
     Text::saveArray($this->artikel->getElementId() . '.intro', $this->request->intro);
     Text::saveArray($this->artikel->getElementId() . '.text', $this->request->text);
     $this->request->clear();
     $this->request->kategorie = $this->artikel->ca_kategorie;
     FlashMessage::success(Strings::GESPEICHERT);
 }
 /**
  * @param Request $request
  * @param Response $response
  */
 protected function update(Request $request, Response $response)
 {
     // TODO: CanEdit
     $this->resource->save($request);
     FlashMessage::success(Strings::GESPEICHERT);
     $this->setMetadata($response);
 }
 /**
  * Startet den Download für eine geteilte Datei
  */
 public function get()
 {
     $this->medien = new Medien();
     $this->medien->loadByToken($this->request->token);
     if (strtotime($this->medien->me_valid_until) < strtotime(date("d.m.Y"))) {
         // Abgelaufen
         FlashMessage::danger('Die Zugriffszeit für diesen Download ist abgelaufen.');
         $this->request->module = 'defaultMod';
         $this->request->action = 'frontpage';
     } else {
         // Download
         $download = new Download();
         $download->do_medium = $this->medien->id;
         $download->do_ip = $_SERVER['REMOTE_ADDR'];
         $download->do_download_am = new \DateTime();
         $download->save();
         $this->medien->me_downloads += 1;
         $this->medien->save();
         $this->kollektion = new Kollektion(Configuration::get('site.shareKollektionId'));
         $handler = new ShareUploadHandler($this->kollektion);
         $handler->downloadShare();
         die;
     }
 }
 public function endEditEntity()
 {
     $this->current = Modules::getModule($this->request->current);
     $this->entity = $this->current->getEntity($this->request->name);
     if ($this->entity === null) {
         $this->entitaetAnlegen($this->current, $this->request->name, $this->request);
     }
     $this->entity->name = $this->request->name;
     $this->entity->primaryKey = $this->request->primary;
     $this->entity->extends = $this->request->extends;
     if ($this->request->match !== '') {
         $this->entity->match = $this->request->match;
     }
     $this->current->save();
     Modules::reload($this->current->name);
     $this->request->id = $this->current->qualifiedName;
     $this->request->hash = 'entity_' . $this->entity->name;
     $this->request->initPanel = 2;
     FlashMessage::success('Entität wurde angelegt');
 }
 /**
  * Wechselt die Identität des angemeldeten Benutzers
  * ACHTUNG! Besondere Sorgfalt bei der Berechtigungsprüfung von Nöten!
  */
 public function doAnmeldenAls()
 {
     // TODO: Berechtigung prüfen
     // TODO: DTV!
     $darfWechsel = Application::isAdmin() || Security::hatRolle('DTV-GS');
     if (!$darfWechsel) {
         FlashMessage::danger('Für diese Aktion haben Sie keine Berechtigung');
         Application::getCurrentResponse()->redirectToFrontpage();
     }
     $this->user = User::loadByBenutzername($this->request->benutzer);
     if ($this->user != null) {
         Security::loginUser($this->user);
         FlashMessage::success('Sie sind jetzt angemeldet als ' . $this->user);
     } else {
         FlashMessage::danger('Benutzername nicht bekannt');
     }
     Application::getCurrentResponse()->redirectToFrontpage();
 }
 public function ausfuehren()
 {
     $this->import = new Import($this->request->id);
     $result = $this->import->ausfuehren();
     if ($result->hasSucceeded()) {
         FlashMessage::success('Der Import wurde erfolgreich ausgeführt');
     } else {
         FlashMessage::danger($result->getMessage());
     }
 }