Skip to content
This repository has been archived by the owner on Nov 8, 2020. It is now read-only.

Commit

Permalink
Added parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
klapuch committed Apr 1, 2017
1 parent b0d0495 commit 820e959
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 93 deletions.
22 changes: 0 additions & 22 deletions Core/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
declare(strict_types = 1);
namespace Klapuch\Application;

use Klapuch\Access;
use Klapuch\Authorization;
use Klapuch\Csrf;
use Klapuch\Form;
use Klapuch\Ini;
use Klapuch\Log;
use Klapuch\Output;
Expand All @@ -17,42 +14,23 @@ abstract class Page {
protected $configuration;
/** @var \Klapuch\Uri\Uri */
protected $url;
/** @var \Klapuch\Access\User */
protected $user;
/** @var \Klapuch\Authorization\Role */
protected $role;
/** @var \PDO */
protected $database;
/** @var \Klapuch\Log\Logs */
protected $logs;
/** @var \Klapuch\Csrf\Csrf */
protected $csrf;
/** @var \Klapuch\Form\Backup */
protected $backup;

public function __construct(
Uri\Uri $url,
\PDO $database,
Log\Logs $logs,
Access\User $user,
Authorization\Role $role,
Ini\Ini $configuration
) {
$this->url = $url;
$this->database = $database;
$this->logs = $logs;
$this->user = $user;
$this->role = $role;
$this->configuration = $configuration->read();
$this->csrf = new Csrf\StoredCsrf($_SESSION, $_POST, $_GET);
$this->backup = new Form\Backup($_SESSION, $_POST);
}

public function startup(): void {
if (!$this->role->allowed($this->url->path())) {
$this->flashMessage('You don\'t have a permission to see the page', 'danger');
$this->redirect($this->url->path() === 'sign/in' ? '' : 'sign/in');
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Core/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private function target(Routing\Route $route, array $configuration): Page {
$configuration['MAPPING']['namespace'],
$configuration['MAPPING']['resolution']
))->resource();
return new $class($this->uri, $this->logs);
return new $class($this->uri, $this->logs, $this->configuration);
}

private function content(Routing\Route $route, Page $target, array $configuration): string {
Expand Down
70 changes: 0 additions & 70 deletions Core/XmlPage.php

This file was deleted.

0 comments on commit 820e959

Please sign in to comment.