summaryrefslogtreecommitdiffstats
path: root/zoom.php
diff options
context:
space:
mode:
Diffstat (limited to 'zoom.php')
-rw-r--r--zoom.php28
1 files changed, 13 insertions, 15 deletions
diff --git a/zoom.php b/zoom.php
index 3143946..39381a7 100644
--- a/zoom.php
+++ b/zoom.php
@@ -39,9 +39,7 @@ require 'include/main.php';
$fedcli = new FedoraPkgdb();
$name = $_GET['rpm'];
-if (isset($_GET['type'])){
- $type = $_GET['type'];
-}
+$type = (isset($_GET['type']) ? $_GET['type'] : "html");
$smarty->assign('name_required', true);
$smarty->assign('name', $name);
@@ -195,41 +193,36 @@ if ( !isset($name) || !$name ) {
);
}
}
-if (!isset($type) || $type == "html"){
- // Displays the output as html
- $page_content = $smarty->fetch('zoom.tpl');
- $smarty->assign('page_content', $page_content);
- $smarty->display('main.tpl');
-} else if ($type == "json"){
+if ($type == "json") {
// Displays the output as json
$json = "{";
$json .= '"package": "' . $name ."\", ";
$json .= '"branch": [';
$cnt = 0;
- foreach ($packages as $package){
+ foreach ($packages as $package) {
$cnt += 1;
$json .= "{";
$json .= '"'. $package->repo_main .'": ';
- if ($package->epoch){
+ if ($package->epoch) {
$json .= '"'.$package->epoch.'" ';
} else {
$json .= '"'.$package->ver."-".$package->rel.'" ';
}
$json .= "}";
- if ($cnt != count($packages)){
+ if ($cnt != count($packages)) {
$json .= ",";
}
}
$json .= "]}";
echo $json;
-} else if ($type == "text"){
+} else if ($type == "text") {
// Displays the output as text
$text = 'package: ' . $name ." \n";
$cnt = 0;
- foreach ($packages as $package){
+ foreach ($packages as $package) {
$cnt += 1;
$text .= $package->repo_main .': ';
- if ($package->epoch){
+ if ($package->epoch) {
$text .= $package->epoch;
} else {
$text .= $package->ver."-".$package->rel;
@@ -237,5 +230,10 @@ if (!isset($type) || $type == "html"){
$text .= "\n";
}
echo $text;
+} else {
+ // Displays the output as html
+ $page_content = $smarty->fetch('zoom.tpl');
+ $smarty->assign('page_content', $page_content);
+ $smarty->display('main.tpl');
}
?>