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

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

parent 64b3fdea
......@@ -516,8 +516,7 @@ function CHECKURL($url, &$error) {
if (strcmp($HTTPTAG, substr($url, 0, strlen($HTTPTAG))) &&
strcmp($HTTPSTAG, substr($url, 0, strlen($HTTPSTAG)))) {
$error = "URL is malformed; must begin with $HTTPTAG or $HTTPSTAG!";
return 0;
$url = "${HTTPTAG}" . $url;
}
$fp = @fopen($url, "r");
......
<?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
#
......@@ -687,9 +687,16 @@ if (! $returning) {
if (! $forwikionly) {
if (isset($formfields["usr_URL"]) &&
strcmp($formfields["usr_URL"], "") &&
strcmp($formfields["usr_URL"], $HTTPTAG) &&
! CHECKURL($formfields["usr_URL"], $urlerror)) {
$errors["Home Page URL"] = $urlerror;
strcmp($formfields["usr_URL"], $HTTPTAG)) {
if (strcmp($HTTPTAG,
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"]) ||
strcmp($formfields["usr_addr"], "") == 0) {
......
......@@ -816,9 +816,16 @@ if (! $returning) {
if (isset($formfields["usr_URL"]) &&
strcmp($formfields["usr_URL"], "") &&
strcmp($formfields["usr_URL"], $HTTPTAG) &&
! $FirstInitState &&
! CHECKURL($formfields["usr_URL"], $urlerror)) {
$errors["Home Page URL"] = $urlerror;
! $FirstInitState) {
if (strcmp($HTTPTAG,
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"]) ||
strcmp($formfields["usr_addr"], "") == 0) {
......@@ -939,9 +946,16 @@ if (!isset($formfields["proj_URL"]) ||
strcmp($formfields["proj_URL"], $HTTPTAG) == 0) {
$errors["Project URL"] = "Missing Field";
}
elseif (! $FirstInitState &&
! CHECKURL($formfields["proj_URL"], $urlerror)) {
$errors["Project URL"] = $urlerror;
elseif (! $FirstInitState) {
if (strcmp($HTTPTAG,
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"]) ||
strcmp($formfields["proj_funders"], "") == 0) {
......@@ -1025,7 +1039,6 @@ if (!$returning) {
$args["wikiname"] = $formfields["wikiname"];
}
if (isset($formfields["usr_URL"]) &&
$formfields["usr_URL"] != $HTTPTAG && $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