Skip to content

Commit

Permalink
Fix path and URL settings at installation
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-lerch committed May 21, 2020
1 parent 8675eb2 commit 890eae1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions inc/ko.inc
Original file line number Diff line number Diff line change
Expand Up @@ -13297,6 +13297,10 @@ function format_userinput($s, $type, $enforce=FALSE, $length=0, $replace=array()
return $new;
break;

case "unescaped":
return addslashes($s);
break;

case "all":
return TRUE;
break;
Expand Down
5 changes: 3 additions & 2 deletions install/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@
if($html_title) ko_update_ko_config("html_title", ('$HTML_TITLE = "'.$html_title.'";'."\n"));
$base_url = format_userinput($_POST["txt_base_url"], "text");
if($base_url) ko_update_ko_config("base_url", ('$BASE_URL = "'.$base_url.'";'."\n"));
$base_path = format_userinput($_POST["txt_base_path"], "text");
// Use "unescaped" mode instead of "text" because Windows file paths contain backslashes that need to be escaped
$base_path = format_userinput($_POST["txt_base_path"], "unescaped");
if(substr($base_path, -1) != "/") $base_path .= "/";
if($base_path) ko_update_ko_config("base_path", ('$BASE_PATH = "'.$base_path.'";'."\n"));

Expand Down Expand Up @@ -180,7 +181,7 @@
$warranty_giver = format_userinput($_POST["txt_warranty_giver"], "text");
$warranty_url = $_POST["txt_warranty_url"];
$warranty_email = $_POST["txt_warranty_email"];
if(substr($warranty_url, 0, 7) != "http://") $warranty_url = "http://".$warranty_url;
if(substr($warranty_url, 0, 7) != "http://" && substr($warranty_url, 0, 8) != "https://") $warranty_url = "http://".$warranty_url;
$data = sprintf('@define("WARRANTY_GIVER", "%s");', $warranty_giver)."\n";
$data .= sprintf('@define("WARRANTY_EMAIL", "%s");', $warranty_email)."\n";
$data .= sprintf('@define("WARRANTY_URL", "%s");', $warranty_url)."\n";
Expand Down

0 comments on commit 890eae1

Please sign in to comment.