diff options
author | Tarulia <takuja@gmx.de> | 2015-10-10 01:39:11 +0300 |
---|---|---|
committer | Tarulia <takuja@gmx.de> | 2015-10-10 01:39:11 +0300 |
commit | 6a76c43ed921decac3e4348ebc57c31d18241815 (patch) | |
tree | c336fe06cdcaab35b135c0ac1260f22ce4b1078c | |
parent | 131e3f3fc242961b537f9fc378a7b27a0def4691 (diff) |
Extend path check for empty string, string length and trailing slash
-rw-r--r-- | setup.php | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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 |