Permalink
Browse files

HTML encode root path and view name

  • Loading branch information...
AliasIO committed Mar 8, 2017
1 parent 0c16064 commit b479f36298d64d52bcdc5d7a3a3daa0b571ef649
Showing with 6 additions and 24 deletions.
  1. +0 −15 public/.htaccess
  2. +1 −4 public/index.php
  3. +3 −3 src/Swiftlet/Abstracts/App.php
  4. +2 −2 src/Swiftlet/Abstracts/Controller.php
View
@@ -1,15 +0,0 @@
-Options All -Indexes
-
-<FilesMatch "(config|.+\.html)\.php">
- deny from all
-</FilesMatch>
-
-<IfModule mod_rewrite.c>
- RewriteEngine on
-
- RewriteCond %{REQUEST_URI} !\.(bmp|cgi|css|flv|gif|ico|jpe?g|js|png|swf|xml)$
- RewriteCond %{REQUEST_FILENAME} !-f
- RewriteCond %{REQUEST_FILENAME} !-d
-
- RewriteRule (.*) ?q=$1&%1 [L,QSA]
-</IfModule>
View
@@ -2,14 +2,11 @@
declare(strict_types=1);
-namespace Swiftlet;
-
chdir(dirname(__FILE__) . '/..');
require 'vendor/autoload.php';
-use \Swiftlet\Factories\App as AppFactory;
-use \Swiftlet\Factories\View as ViewFactory;
+use \Swiftlet\Factories\{App as AppFactory, View as ViewFactory};
try {
$view = ViewFactory::build();
@@ -63,9 +63,9 @@ public function __construct(ViewInterface $view, string $vendor = 'Swiftlet', st
$this->vendor = $vendor;
$this->vendorPath = rtrim($vendorPath, '/') . '/';
- $this->view->vendor = $this->vendor;
- $this->view->vendorPath = $this->vendorPath;
- $this->view->rootPath = $this->getRootPath();
+ $this->view->vendor = $view->htmlEncode($this->vendor);
+ $this->view->vendorPath = $view->htmlEncode($this->vendorPath);
+ $this->view->rootPath = $view->htmlEncode($this->getRootPath());
}
/**
@@ -47,8 +47,8 @@ public function __construct(AppInterface $app, ViewInterface $view)
$reflection = new \ReflectionClass($this);
- $this->view->name = strtolower($reflection->getShortName());
- $this->view->pageTitle = $this->title;
+ $this->view->name = $view->htmlEncode(strtolower($reflection->getShortName()));
+ $this->view->pageTitle = $view->htmlEncode($this->title);
}
/**

0 comments on commit b479f36

Please sign in to comment.