From c14322fae3658cf448dc30a858666badfb1ce5b2 Mon Sep 17 00:00:00 2001 From: "Johan \"Papa\" Cwiklinski" Date: Sat, 29 May 2010 21:50:37 +0200 Subject: Show errors from template ; refs #47 --- zoom.php | 182 ++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 93 insertions(+), 89 deletions(-) (limited to 'zoom.php') diff --git a/zoom.php b/zoom.php index 913ce18..dba885a 100644 --- a/zoom.php +++ b/zoom.php @@ -1,4 +1,20 @@ . +*/ 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 ) { -?> -

Missing package name

-
-

You have not specified any package name.

-

-
- -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 "

$name not found

\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 "

$name not found

\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'); -- cgit