summaryrefslogtreecommitdiffstats
path: root/zoom.php
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2010-09-19 10:06:10 +0200
committerRemi Collet <fedora@famillecollet.com>2010-09-19 10:06:10 +0200
commit17b1b4b609c3437744b127427d9f366b93eb8910 (patch)
tree20e8fb1b5ebf8a680b6b926e907e9fdb91cc55a2 /zoom.php
parent0275880dbd7380b5b6a38a6902aef4063fc89f63 (diff)
clean + coding standard
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');
}
?>