summaryrefslogtreecommitdiffstats
path: root/zoom.php
diff options
context:
space:
mode:
authorJohan "Papa" Cwiklinski <trasher@odysseus.(none)>2010-05-29 21:50:37 +0200
committerJohan "Papa" Cwiklinski <trasher@odysseus.(none)>2010-05-29 21:50:37 +0200
commitc14322fae3658cf448dc30a858666badfb1ce5b2 (patch)
tree53594a07d79644047a132a41af55f1e7ab21e8c6 /zoom.php
parent984fed1620d14acf0009122f578a59cdfba5b287 (diff)
Show errors from template ; refs #47
Diffstat (limited to 'zoom.php')
-rw-r--r--zoom.php182
1 files changed, 93 insertions, 89 deletions
diff --git a/zoom.php b/zoom.php
index 913ce18..dba885a 100644
--- a/zoom.php
+++ b/zoom.php
@@ -1,4 +1,20 @@
<?php
+/**
+* This file is part of rpmphp.
+*
+* rpmphp is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Affero General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* rpmphp is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Affero General Public License for more details.
+*
+* You should have received a copy of the GNU Affero General Public License
+* along with rpmphp. If not, see <http://www.gnu.org/licenses/agpl-3.0-standalone.html>.
+*/
require 'main.inc.php';
require 'FedoraClient.php';
@@ -24,17 +40,17 @@ function getBranchPeople($params)
if ($branch == 'rawhide' && isset($fedpkg['devel']['owner']) ) {
if ( !$people || $people == '' || $people == 'owner' ) {
$ret = $fedpkg['devel']['owner'];
- } else if( $people == 'people') {
+ } else if ( $people == 'people') {
$ret_tmp = $fedpkg['devel']['people'];
}
} else if (isset($fedpkg[$branch]['owner'])) {
if ( !$people || $people == '' || $people == 'owner' ) {
$ret = $fedpkg[$branch]['owner'];
- } else if( $people == 'people') {
+ } else if ( $people == 'people') {
$ret_tmp = $fedpkg[$branch]['people'];
}
}
- if( $people == 'people') {
+ if ( $people == 'people') {
foreach ( $ret_tmp as $r ) {
if ( $ret !== null ) {
$ret .= ', ';
@@ -47,100 +63,88 @@ function getBranchPeople($params)
$smarty->register_function('getBranchPeople', 'getBranchPeople');
if ( !isset($name) || !$name ) {
-?>
- <h1>Missing package name</h1>
- <form action="?" method="get">
- <p>You have not specified any package name.</p>
- <p><label for="rpm">Please enter one package name: </label><input type="text" name="rpm" id="rpm"/> <input type="submit"/></p>
- </form>
-
-<?php
+ $smarty->assign('error', 'missing_name');
} else {
- try {
- $db = new PDO ("mysql:dbname=" . MYBASE . ";host=" . MYHOST, MYUSER, MYPASS);
-
- $sql = "SELECT rpm.*
- FROM rpm
- INNER JOIN repo ON (repo.main=rpm.repo_main AND repo.sub=rpm.repo_sub)
- WHERE rpm.name='$name'
- ORDER BY repo.id DESC";
- $resrpm = $db->query($sql);
- $rpm = ($resrpm ? $resrpm->fetchObject() : false);
-
- $sql = "SELECT * FROM upstream WHERE name = '$name'";
- $resup=$db->query($sql);
- $up = ($resup ? $resup->fetchObject() : false);
-
- $sql = "SELECT * FROM acls WHERE name = '$name'";
- $resown=$db->query($sql);
- $owner = ($resown ? $resown->fetchObject() : false);
-
- if (!$rpm) {
- echo "<h1>$name not found</h1>\n";
- } else {
-
- if ($rpm->summary) {
- $summary['Summary'] = $rpm->summary;
- } else if ($owner->summary) {
- $summary['Summary'] = $owner->summary;
- }
- $summary['Description'] = ((isset($fedpkg['devel']['package']['description'])) ? $fedpkg['devel']['package']['description'] : $ajax_infos);
- if ( $rpm->url ) {
- $summary['URL'] = $rpm->url;
- }
- if ($up && $up->type) {
- $summary['Type'] = $up->type;
- }
- if ($up && $up->channel) {
- $summary['Channel'] = $up->channel;
- }
- if ($up && $up->stable) {
- $summary['Stabe version'] = $up->stable;
- }
- if ($up && $up->unstable && $up->stable!=$up->unstable) {
- if ($up->state) {
- $summary['Unstable version'] = $up->unstable . ' (' . $up->state . ')';
- } else {
- $summary['Unstable version'] = $up->unstable;
+ try {
+ $db = new PDO ("mysql:dbname=" . MYBASE . ";host=" . MYHOST, MYUSER, MYPASS);
+
+ $sql = "SELECT rpm.*
+ FROM rpm
+ INNER JOIN repo ON (repo.main=rpm.repo_main AND repo.sub=rpm.repo_sub)
+ WHERE rpm.name='$name'
+ ORDER BY repo.id DESC";
+ $resrpm = $db->query($sql);
+ $rpm = ($resrpm ? $resrpm->fetchObject() : false);
+
+ $sql = "SELECT * FROM upstream WHERE name = '$name'";
+ $resup=$db->query($sql);
+ $up = ($resup ? $resup->fetchObject() : false);
+
+ $sql = "SELECT * FROM acls WHERE name = '$name'";
+ $resown=$db->query($sql);
+ $owner = ($resown ? $resown->fetchObject() : false);
+
+ if (!$rpm) {
+ echo "<h1>$name not found</h1>\n";
+ } else {
+ if ($rpm->summary) {
+ $summary['Summary'] = $rpm->summary;
+ } else if ($owner->summary) {
+ $summary['Summary'] = $owner->summary;
}
+ $summary['Description'] = ((isset($fedpkg['devel']['package']['description'])) ? $fedpkg['devel']['package']['description'] : $ajax_infos);
+ if ( $rpm->url ) {
+ $summary['URL'] = $rpm->url;
+ }
+ if ($up && $up->type) {
+ $summary['Type'] = $up->type;
+ }
+ if ($up && $up->channel) {
+ $summary['Channel'] = $up->channel;
+ }
+ if ($up && $up->stable) {
+ $summary['Stabe version'] = $up->stable;
+ }
+ if ($up && $up->unstable && $up->stable!=$up->unstable) {
+ if ($up->state) {
+ $summary['Unstable version'] = $up->unstable . ' (' . $up->state . ')';
+ } else {
+ $summary['Unstable version'] = $up->unstable;
+ }
+ }
+ if ($owner && $owner->owner) {
+ if ($owner->cc) {
+ $summary['Owner'] = $owner->owner . ' (' . $owner->cc . ')';
+ } else {
+ $summary['Owner'] = $owner->owner;
+ }
+ }
+ $summary['ViewVC'] = 'http://cvs.fedoraproject.org/viewvc/rpms/' . $name . '/';
- }
- if ($owner && $owner->owner) {
- if ($owner->cc) {
- $summary['Owner'] = $owner->owner . ' (' . $owner->cc . ')';
+ if (isset($_GET['pkgdb'])) {
+ $fedpkg = $fedcli->getPackageInfo($name);
} else {
- $summary['Owner'] = $owner->owner;
+ $fedpkg = false;
}
+ $i=0;
+
+ $prev=false;
+ do {
+ $packages[] = $rpm;
+ if ( $rpm->repo_main != $prev ) {
+ $prev = $rpm->repo_main;
+ }
+ } while ( $rpm = $resrpm->fetchObject() );
}
- $summary['ViewVC'] = 'http://cvs.fedoraproject.org/viewvc/rpms/' . $name . '/';
-
-
- if (isset($_GET['pkgdb'])) {
- $fedpkg = $fedcli->getPackageInfo($name);
- } else {
- $fedpkg = false;
- }
- $i=0;
-
- $prev=false;
- do {
- $packages[] = $rpm;
- if( $rpm->repo_main != $prev ) {
- $prev = $rpm->repo_main;
- }
-
- } while ($rpm = $resrpm->fetchObject());
- }
- }
- catch(PDOException $e) {
- printf("%s ERREUR : %s\n", date("r"), $e->getMessage());
- }
+ $smarty->assign('pkgdb', (isset($_GET['pkgdb']) ? $_GET['pkgdb'] : null));
+ $smarty->assign('summary', $summary);
+ $smarty->assign('packages', $packages);
+ $smarty->assign('fedpkg', $fedpkg);
+ } catch(PDOException $e) {
+ printf("%s ERREUR : %s\n", date("r"), $e->getMessage());
+ }
}
-$smarty->assign('pkgdb', (isset($_GET['pkgdb']) ? $_GET['pkgdb'] : null));
-$smarty->assign('summary', $summary);
-$smarty->assign('packages', $packages);
-$smarty->assign('fedpkg', $fedpkg);
$page_content = $smarty->fetch('zoom.tpl');
$smarty->assign('page_content', $page_content);
$smarty->display('main.tpl');