| <?php |
| /** |
| * This REST page, returns the XML representation of a bug. This information is retrieved from the common/server/bug-server.class.php |
| * and used for the client counterpart common/bug.class.php |
| * |
| * I takes the <b>bug_id</b> as parameter, the <b>bug_id</b> value has to be an intenger number, greater than zero. |
| * <br><br> |
| * for example: <br> |
| * <samp> |
| * http://eclipse.org/projects/web-api/bug.php?bug_id=1024 |
| * </samp> |
| * <br><br> |
| * in case of *invalid* <var>bug_id</var> it will return an error, in case of an inexistant <var>bug_id</var> it will return all tags empty, |
| * except for <var>bug_id</var> which will be the same as the <b>?bug_id</b> parameter and description which will be <i>"Bug #0"</i>. |
| * |
| * @package rest-api |
| * @license http://www.eclipse.org/legal/epl-v10.html Eclipse Public License - v 1.0 |
| * @author Eduardo A. Romero |
| */ |
| |
| |
| /** |
| * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (http://www.eclipse.org/legal/epl-v10.html). |
| * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. |
| * |
| */ |
| |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/projects/common/server/bug-server.class.php"); |
| |
| |
| |
| |
| |
| header("Content-type: text/xml"); |
| header("Pragma: public"); |
| header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); |
| echo "<?xml version='1.0' encoding='iso-8859-1'?>\n"; |
| |
| $bug_id = 0; |
| /** |
| * Get the BUG ID |
| */ |
| if(isset($_REQUEST['bug_id'])) |
| $bug_id = $_REQUEST['bug_id']; |
| ?> |
| <bug><? |
| /* |
| * a valid BUGID has to be Integer greater than zero |
| */ |
| if(is_numeric($bug_id) && $bug_id > 0) |
| { |
| $bug = new Bug_Server($bug_id, true); |
| $description = $bug->getDescription(); |
| $reporter = $bug->getReporter(); |
| $severity = $bug->getSeverity(); |
| $assignee = $bug->getAssignee(); |
| $url = $bug->getURL(); |
| $status = $bug->getStatus(); |
| $resolution = $bug->getResolution(); |
| $priority = $bug->getPriority(); |
| $votes = $bug->getVotes(); |
| $product = $bug->getProduct(); |
| $classification = $bug->getClassification(); |
| $component = $bug->getComponent(); |
| |
| // output XML |
| ?> |
| <bug><?= $bug_id ?></bug> |
| <description><?= htmlentities( $description )?></description> |
| <reporter><?= htmlentities( $reporter ) ?></reporter> |
| <severity><?= htmlentities( $severity ) ?></severity> |
| <assignee><?= htmlentities( $assignee ) ?></assignee> |
| <url><?= htmlentities( $url ) ?></url> |
| <status><?= htmlentities( $status ) ?></status> |
| <resolution><?= htmlentities( $resolution ) ?></resolution> |
| <priority><?= htmlentities( $priority ) ?></priority> |
| <votes><?= htmlentities( $votes ) ?></votes> |
| <product><?= htmlentities( $product ) ?></product> |
| <classification><?= htmlentities( $classification ) ?></classification> |
| <component><?= htmlentities( $component ) ?></component> |
| <? |
| } |
| else |
| { |
| ?><error>bug_id has to be an integer, greater than zero.</error><? |
| } |
| ?> |
| </bug> |