| <?php |
| /** |
| * ***************************************************************************** |
| * Copyright (c) 2010, 2022 Eclipse Foundation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * ***************************************************************************** |
| */ |
| |
| header("Pragma: no-cache"); |
| |
| require_once '../_projectCommon.php'; |
| |
| require_once ($_SERVER['DOCUMENT_ROOT'] . "/projects/classes/common.php"); |
| require_once ($_SERVER['DOCUMENT_ROOT'] . "/projects/classes/debug.php"); |
| |
| /* |
| * Gather up the parameters from the request so that we can |
| * include them in URLs that we place on the page. I suppose that |
| * we could use cookies... |
| * TODO Consider using cookies. |
| */ |
| function cleanupKey($key) { |
| return preg_replace('/[^-a-zA-Z0-9_]/', '', $key); |
| } |
| |
| function cleanupValue($value) { |
| if (isValidProjectId($value)) |
| return $value; |
| return preg_replace('/[^-a-zA-Z0-9_]/', '', $value); |
| } |
| |
| $parameters = ''; |
| $separator = '?'; |
| foreach ($_GET as $key => $value) { |
| $parameters .= $separator . cleanupKey($key) . '=' . cleanupValue($value); |
| $separator = '&'; |
| } |
| |
| if ($id = @$_GET['id']) { |
| require_once ($_SERVER['DOCUMENT_ROOT'] . "/projects/classes/Project.class.php"); |
| if ($project = Project::getProject($id)) { |
| $Nav->addNavSeparator($project->getName(), "index.php$parameters"); |
| $url = $project->getUrl(); |
| $Nav->addCustomNav("Project PMI Page", $url, "_self", 2); |
| $Nav->addCustomNav("Next release", "$url/next-release", "_self", 2); |
| $Nav->addCustomNav("Documentation Generator", "/projects/tools/documentation.php$parameters", "_self", 2); |
| } |
| } |
| |
| // Avoid leaving variables with values; avoid confusing |
| // the script that imports this. |
| // TODO Encapsulate the variables in a context. |
| unset($parameters); |
| unset($separator); |
| unset($id); |
| unset($project); |
| ?> |