archive_control.php3 1.01 KB
Newer Older
1 2 3
<?php
#
# EMULAB-COPYRIGHT
4
# Copyright (c) 2006, 2007 University of Utah and the Flux Group.
5 6 7 8 9 10 11
# All rights reserved.
#
include("defs.php3");

#
# Only known and logged in users.
#
12 13 14
$this_user = CheckLoginOrDie();
$uid       = $this_user->uid();
$isadmin   = ISADMIN();
15 16 17 18

#
# Verify page arguments.
#
19
$reqargs  = RequiredPageArguments("experiment", PAGEARG_EXPERIMENT);
20 21 22 23 24
$optargs  = OptionalPageArguments("action", PAGEARG_STRING);

if (!isset($action) || $action == "tag" || $action == "commit") {
    $action    = "commit";
}
25 26 27 28

#
# Verify Permission.
#
29
if (! $experiment->AccessCheck($this_user, $TB_EXPT_MODIFY)) {
30 31 32
    USERERROR("You do not have permission to view experiment $eid!", 1);
}

33 34 35
# Group to suexc as.
$pid = $experiment->pid();
$gid = $experiment->gid();
36

37 38 39 40 41 42 43
if ($action == "commit") {
    SUEXEC($uid, "$pid,$gid",
	   "webarchive_control commit $pid $eid",
	   SUEXEC_ACTION_DIE);

    $newurl = preg_replace("/archive_control/",
			   "archive_view", $_SERVER['REQUEST_URI']);
44

45 46 47
    header("Location: $newurl");
    exit(0);
}
48 49

?>