Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/cydrobolt/polr.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTarulia <takuja@gmx.de>2015-10-10 01:39:11 +0300
committerTarulia <takuja@gmx.de>2015-10-10 01:39:11 +0300
commit6a76c43ed921decac3e4348ebc57c31d18241815 (patch)
treec336fe06cdcaab35b135c0ac1260f22ce4b1078c
parent131e3f3fc242961b537f9fc378a7b27a0def4691 (diff)
Extend path check for empty string, string length and trailing slash
-rw-r--r--setup.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/setup.php b/setup.php
index bef50ba..a392933 100644
--- a/setup.php
+++ b/setup.php
@@ -128,8 +128,11 @@ PHP;
require_once('lib-core.php');
$path = $_POST['path'];
// check if path ends with / , validating it for .htaccess
- if ( !(substr( $path, -1) == "/") ) {
- die("<p class='alert alert-danger'>Path needs trailing slash (<code>/</code>).</p>");
+ if ( empty( $path ) ) {
+ echo "<p class='alert alert-success'>Path is empty, no <strong>.htaccess</strong> needs to be written.</p>";
+ } elseif ( !( ( strlen( $path) > 2) &&
+ ( substr( $path, -1 ) == "/") ) ) {
+ echo "<p class='alert alert-danger'>Path needs trailing slash (<code>/</code>) and cannot be a slash only.</p>";
} else {
$data = "<IfModule mod_rewrite.c>
RewriteEngine On