Commit 0e3a7be5 authored by Leigh B Stoller's avatar Leigh B Stoller

Do not require http:// or https:// on user/proj urls.

parent 64b3fdea
...@@ -516,8 +516,7 @@ function CHECKURL($url, &$error) { ...@@ -516,8 +516,7 @@ function CHECKURL($url, &$error) {
if (strcmp($HTTPTAG, substr($url, 0, strlen($HTTPTAG))) && if (strcmp($HTTPTAG, substr($url, 0, strlen($HTTPTAG))) &&
strcmp($HTTPSTAG, substr($url, 0, strlen($HTTPSTAG)))) { strcmp($HTTPSTAG, substr($url, 0, strlen($HTTPSTAG)))) {
$error = "URL is malformed; must begin with $HTTPTAG or $HTTPSTAG!"; $url = "${HTTPTAG}" . $url;
return 0;
} }
$fp = @fopen($url, "r"); $fp = @fopen($url, "r");
......
<?php <?php
# #
# Copyright (c) 2000-2013 University of Utah and the Flux Group. # Copyright (c) 2000-2014 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -687,9 +687,16 @@ if (! $returning) { ...@@ -687,9 +687,16 @@ if (! $returning) {
if (! $forwikionly) { if (! $forwikionly) {
if (isset($formfields["usr_URL"]) && if (isset($formfields["usr_URL"]) &&
strcmp($formfields["usr_URL"], "") && strcmp($formfields["usr_URL"], "") &&
strcmp($formfields["usr_URL"], $HTTPTAG) && strcmp($formfields["usr_URL"], $HTTPTAG)) {
! CHECKURL($formfields["usr_URL"], $urlerror)) { if (strcmp($HTTPTAG,
$errors["Home Page URL"] = $urlerror; substr($formfields["usr_URL"], 0, strlen($HTTPTAG))) &&
strcmp($HTTPSTAG,
substr($formfields["usr_URL"], 0, strlen($HTTPSTAG)))) {
$formfields["usr_URL"] = "${HTTPTAG}" . $formfields["usr_URL"];
}
if (! CHECKURL($formfields["usr_URL"], $urlerror)) {
$errors["Home Page URL"] = $urlerror;
}
} }
if (!isset($formfields["usr_addr"]) || if (!isset($formfields["usr_addr"]) ||
strcmp($formfields["usr_addr"], "") == 0) { strcmp($formfields["usr_addr"], "") == 0) {
......
...@@ -816,9 +816,16 @@ if (! $returning) { ...@@ -816,9 +816,16 @@ if (! $returning) {
if (isset($formfields["usr_URL"]) && if (isset($formfields["usr_URL"]) &&
strcmp($formfields["usr_URL"], "") && strcmp($formfields["usr_URL"], "") &&
strcmp($formfields["usr_URL"], $HTTPTAG) && strcmp($formfields["usr_URL"], $HTTPTAG) &&
! $FirstInitState && ! $FirstInitState) {
! CHECKURL($formfields["usr_URL"], $urlerror)) { if (strcmp($HTTPTAG,
$errors["Home Page URL"] = $urlerror; substr($formfields["usr_URL"], 0, strlen($HTTPTAG))) &&
strcmp($HTTPSTAG,
substr($formfields["usr_URL"], 0, strlen($HTTPSTAG)))) {
$formfields["usr_URL"] = "${HTTPTAG}" . $formfields["usr_URL"];
}
if (! CHECKURL($formfields["usr_URL"], $urlerror)) {
$errors["Home Page URL"] = $urlerror;
}
} }
if (!isset($formfields["usr_addr"]) || if (!isset($formfields["usr_addr"]) ||
strcmp($formfields["usr_addr"], "") == 0) { strcmp($formfields["usr_addr"], "") == 0) {
...@@ -939,9 +946,16 @@ if (!isset($formfields["proj_URL"]) || ...@@ -939,9 +946,16 @@ if (!isset($formfields["proj_URL"]) ||
strcmp($formfields["proj_URL"], $HTTPTAG) == 0) { strcmp($formfields["proj_URL"], $HTTPTAG) == 0) {
$errors["Project URL"] = "Missing Field"; $errors["Project URL"] = "Missing Field";
} }
elseif (! $FirstInitState && elseif (! $FirstInitState) {
! CHECKURL($formfields["proj_URL"], $urlerror)) { if (strcmp($HTTPTAG,
$errors["Project URL"] = $urlerror; substr($formfields["proj_URL"], 0, strlen($HTTPTAG))) &&
strcmp($HTTPSTAG,
substr($formfields["proj_URL"], 0, strlen($HTTPSTAG)))) {
$formfields["proj_URL"] = "${HTTPTAG}" . $formfields["proj_URL"];
}
if (!CHECKURL($formfields["proj_URL"], $urlerror)) {
$errors["Project URL"] = $urlerror;
}
} }
if (!isset($formfields["proj_funders"]) || if (!isset($formfields["proj_funders"]) ||
strcmp($formfields["proj_funders"], "") == 0) { strcmp($formfields["proj_funders"], "") == 0) {
...@@ -1025,7 +1039,6 @@ if (!$returning) { ...@@ -1025,7 +1039,6 @@ if (!$returning) {
$args["wikiname"] = $formfields["wikiname"]; $args["wikiname"] = $formfields["wikiname"];
} }
if (isset($formfields["usr_URL"]) && if (isset($formfields["usr_URL"]) &&
$formfields["usr_URL"] != $HTTPTAG && $formfields["usr_URL"] != "") { $formfields["usr_URL"] != $HTTPTAG && $formfields["usr_URL"] != "") {
$args["URL"] = $formfields["usr_URL"]; $args["URL"] = $formfields["usr_URL"];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment