Commit 9577ec16 authored by Mike Hibler's avatar Mike Hibler

More PHP5 changes.

parent 53fc7653
<?php <?php
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group. # Copyright (c) 2000-2007, 2010 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
...@@ -35,12 +35,12 @@ function INITFORM($formfields, $projlist) ...@@ -35,12 +35,12 @@ function INITFORM($formfields, $projlist)
# this is to have another page for netbuild that does some magic and # this is to have another page for netbuild that does some magic and
# redirects the browser to this page. # redirects the browser to this page.
# #
if (isset($nsref) && $nsref != "" && ereg("^[0-9]+$", $nsref)) if (isset($nsref) && $nsref != "" && preg_match('/^[0-9]+$/', $nsref))
$defaults["nsref"] = $nsref; $defaults["nsref"] = $nsref;
else else
unset($nsref); unset($nsref);
if (isset($guid) && $guid != "" && ereg("^[0-9]+$", $guid)) if (isset($guid) && $guid != "" && preg_match('/^[0-9]+$/', $guid))
$defaults["guid"] = $guid; $defaults["guid"] = $guid;
else else
unset($guid); unset($guid);
......
<?php <?php
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group. # Copyright (c) 2000-2010 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
...@@ -21,7 +21,7 @@ $optargs = OptionalPageArguments("guid", PAGEARG_INTEGER, ...@@ -21,7 +21,7 @@ $optargs = OptionalPageArguments("guid", PAGEARG_INTEGER,
# #
# Only known and logged in users. # Only known and logged in users.
# #
if (isset($guid) && ereg("^[0-9]+$", $guid)) { if (isset($guid) && preg_match('/^[0-9]+$/', $guid)) {
$uid = $guid; $uid = $guid;
} }
else { else {
...@@ -38,7 +38,7 @@ if (!isset($nsdata)) { ...@@ -38,7 +38,7 @@ if (!isset($nsdata)) {
USERERROR("Need to send NSFILE!", 1); USERERROR("Need to send NSFILE!", 1);
} }
if (!isset($nsref) || !ereg("^[0-9]+$", $nsref)) { if (!isset($nsref) || !preg_match('/^[0-9]+$/', $nsref)) {
USERERROR("Need to send valid NSREF!", 1); USERERROR("Need to send valid NSREF!", 1);
} }
......
<?php <?php
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2003, 2007 University of Utah and the Flux Group. # Copyright (c) 2000-2010 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
require("defs.php3"); require("defs.php3");
...@@ -98,7 +98,7 @@ if ((!isset($cdkey) || !strcmp($cdkey, ""))) { ...@@ -98,7 +98,7 @@ if ((!isset($cdkey) || !strcmp($cdkey, ""))) {
return; return;
} }
if (!ereg("[0-9a-zA-Z]+", $cdkey)) { if (!preg_match('/[0-9a-zA-Z]+/', $cdkey)) {
SPITSTATUS(CDROMSTATUS_INVALIDARGS); SPITSTATUS(CDROMSTATUS_INVALIDARGS);
return; return;
} }
...@@ -157,14 +157,14 @@ if ((!isset($privkey) || !strcmp($privkey, "")) || ...@@ -157,14 +157,14 @@ if ((!isset($privkey) || !strcmp($privkey, "")) ||
return; return;
} }
if (!ereg("[0-9a-zA-Z ]+", $privkey) || if (!preg_match('/[0-9a-zA-Z ]+/', $privkey) ||
!ereg("[0-9\.]+", $IP)) { !preg_match('/[0-9\.]+/', $IP)) {
SPITSTATUS(CDROMSTATUS_INVALIDARGS); SPITSTATUS(CDROMSTATUS_INVALIDARGS);
return; return;
} }
if (isset($wahostname) && if (isset($wahostname) &&
!ereg("[-_0-9a-zA-Z\.]+", $wahostname)) { !preg_match('/[-_0-9a-zA-Z\.]+/', $wahostname)) {
SPITSTATUS(CDROMSTATUS_INVALIDARGS); SPITSTATUS(CDROMSTATUS_INVALIDARGS);
return; return;
} }
...@@ -183,7 +183,7 @@ if (isset($wahostname)) { ...@@ -183,7 +183,7 @@ if (isset($wahostname)) {
} }
if (isset($roottag) && if (isset($roottag) &&
!ereg("[0-9a-zA-Z]+", $roottag)) { !preg_match('/[0-9a-zA-Z]+/', $roottag)) {
SPITSTATUS(CDROMSTATUS_INVALIDARGS); SPITSTATUS(CDROMSTATUS_INVALIDARGS);
return; return;
} }
......
<?php <?php
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2009 University of Utah and the Flux Group. # Copyright (c) 2000-2010 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
# Lets emulate register_globals=off for a while. # Lets emulate register_globals=off for a while.
...@@ -532,12 +532,12 @@ function VALIDUSERPATH($path, $uid="", $pid="", $gid="", $eid="") ...@@ -532,12 +532,12 @@ function VALIDUSERPATH($path, $uid="", $pid="", $gid="", $eid="")
# No ids specified, just make sure it starts with an appropriate prefix. # No ids specified, just make sure it starts with an appropriate prefix.
# #
if (!$uid && !$pid && !$gid && !$eid) { if (!$uid && !$pid && !$gid && !$eid) {
if (ereg("^$TBPROJ_DIR/.*", $path) || if (preg_match("/^$TBPROJ_DIR\/.*/", $path) ||
ereg("^$TBUSER_DIR/.*", $path) || preg_match("/^$TBUSER_DIR\/.*/", $path) ||
ereg("^$TBGROUP_DIR/.*", $path)) { preg_match("/^$TBGROUP_DIR\/.*/", $path)) {
return 1; return 1;
} }
if ($TBSCRATCH_DIR && ereg("^$TBSCRATCH_DIR/.*", $path)) { if ($TBSCRATCH_DIR && preg_match("/^$TBSCRATCH_DIR\/.*/", $path)) {
return 1; return 1;
} }
return 0; return 0;
......
<?php <?php
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group. # Copyright (c) 2000-2010 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
include("defs.php3"); include("defs.php3");
...@@ -535,7 +535,7 @@ while (list ($header, $value) = each ($formfields)) { ...@@ -535,7 +535,7 @@ while (list ($header, $value) = each ($formfields)) {
continue; continue;
} }
if (!isset($value) || !strcmp($value, "") || if (!isset($value) || !strcmp($value, "") ||
!ereg("^[0-9\.bs]*$", "$value")) { !preg_match('/^[0-9\.bs]*$/', "$value")) {
continue; continue;
} }
......
<?php <?php
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group. # Copyright (c) 2000-2010 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
include("defs.php3"); include("defs.php3");
...@@ -31,7 +31,7 @@ if (! ($isadmin || OPSGUY())) { ...@@ -31,7 +31,7 @@ if (! ($isadmin || OPSGUY())) {
# #
# Check log type. Strictly letters, not too long. # Check log type. Strictly letters, not too long.
# #
if (! ereg("^[a-zA-Z]+$", $log_type) || strlen($log_type) > 32) { if (!preg_match('/^[a-zA-Z]+$/', $log_type) || strlen($log_type) > 32) {
USERERROR("The log type you gave looks funky!", 1); USERERROR("The log type you gave looks funky!", 1);
} }
......
<?php <?php
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2003, 2005-2007 University of Utah and the Flux Group. # Copyright (c) 2000-2010 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
include("defs.php3"); include("defs.php3");
...@@ -134,8 +134,8 @@ if (isset($nsdata) && strcmp($nsdata, "") != 0) { ...@@ -134,8 +134,8 @@ if (isset($nsdata) && strcmp($nsdata, "") != 0) {
header("Content-Type: text/plain"); header("Content-Type: text/plain");
echo "$nsdata"; echo "$nsdata";
} elseif (isset($nsref) && strcmp($nsref,"") != 0 && } elseif (isset($nsref) && strcmp($nsref,"") != 0 &&
ereg("^[0-9]+$", $nsref)) { preg_match('/^[0-9]+$/', $nsref)) {
if (isset($guid) && ereg("^[0-9]+$", $guid)) { if (isset($guid) && preg_match('/^[0-9]+$/', $guid)) {
$nsfile = "/tmp/$guid-$nsref.nsfile"; $nsfile = "/tmp/$guid-$nsref.nsfile";
$id = $guid; $id = $guid;
} else { } else {
......
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