diff options
author | Johan "Papa" Cwiklinski <trasher@odysseus.(none)> | 2010-05-29 22:44:10 +0200 |
---|---|---|
committer | Johan "Papa" Cwiklinski <trasher@odysseus.(none)> | 2010-05-29 22:44:10 +0200 |
commit | cbd3c42f9d39f7d73c77cf811c7f65fce9cd1b55 (patch) | |
tree | d3f6529a94191169bcf625e2a87fae597d75c851 /index.php | |
parent | 3a7c67284db39bc8a0618903f7de93603867f4b0 (diff) |
Use of Smarty for index page ; apply coding standards, add license ; refs #46,48,47
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 150 |
1 files changed, 71 insertions, 79 deletions
@@ -1,85 +1,77 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> - <head> - <title>Packages in Fedora</title> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> - <link rel="stylesheet" type="text/css" media="screen" href="css/rpmphp.css"/> - <!--<link rel="stylesheet" type="text/css" media="print" href="css/rpmphp-print.css">--> - <link rel="shortcut icon" href="images/favicon.ico"/> - <link rel="icon" href="images/favicon.ico"/> - </head> - - <body> - <div id="wrapper"> -<?php -include '_header.php'; -?> - <!-- content BEGIN --> - <div id="fedora-content"> - <div id="ariane"> - <p>You are here: </p> - <ul> - <li><a href="#">Reports home</a></li> - </ul> - </div> - <h1>Packages in Fedora repositories</h1> - <h2>Package reports</h2> - <ul id="reports"> - <li><a href="rpm.php?type=pecl">PECL Extensions in Fedora</a> with upstream information</li> - <li><a href="rpm.php?type=pear">PEAR Extensions in Fedora</a> with upstream information</li> - <li><a href="rpm.php?type=R">R Extensions in Fedora</a> with upstream information</li> - <li><a href="all.php">All Packages in Fedora</a></li> - </ul><!-- /reports --> - <table id="list-packages"> - <caption><strong>Analysed repositories</strong></caption> - <thead> - <tr> - <th>Main</th> - <th>Active</th> - <th>Sub</th> - <th>Url</th> - <th>Last update</th> - </tr> - </thead> - <tbody> <?php -require "config.inc.php"; + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Display informations from a specific package + * + * PHP version 5 + * + * Copyright © 2010 Remi Collet + * + * 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/>. + * + * @category Main + * @package RPMPHP + * + * @author Remi Collet <unknown@unknwown.com> + * @author Johan Cwiklinski <johan@x-tnd.be> + * @copyright 2010 Remi Collet + * @license http://www.gnu.org/licenses/agpl-3.0-standalone.html AGPL License 3.0 or (at your option) any later version + * @version SVN: $Id: ajouter_adherent.php 836 2010-02-27 08:11:44Z trashy $ + * @link http://github.com/remicollet/rpmphp/ + * @since The begining of times. +*/ +require 'main.inc.php'; + +$smarty->assign('ariane', $ariane); +$smarty->assign('page_title', 'Packages in Fedora repositories'); + try { - $db = new PDO ("mysql:dbname=" . MYBASE . ";host=" . MYHOST, MYUSER, MYPASS); + $db = new PDO ("mysql:dbname=" . MYBASE . ";host=" . MYHOST, MYUSER, MYPASS); - $sql='SELECT * FROM repo ORDER BY ID'; - $res=$db->query($sql); - if ($res) for ($i=0, $prev="xx" ; $repo=$res->fetchObject() ; $i++, $prev=$repo->main) { - printf ("<tr class='%s'><td><strong>%s</strong></td><td>%s</td><td>%s</td><td><a href='%s'>%s</a></td><td>%s</td></tr>\n", - ($i%2 ? 'odd' : 'even'), - ($repo->main != $prev ? $repo->main : " "), - ($repo->main != $prev ? ($repo->active ? "<strong>Yes</strong>" : "no") : " "), - $repo->sub, $repo->url, $repo->url, date("r", $repo->stamp)); - } + $sql='SELECT * FROM repo ORDER BY ID'; + $res=$db->query($sql); + $repositories = null; + if ( $res ) { + for ( $i=0, $prev="xx"; + $repo=$res->fetchObject(); + $i++, $prev=$repo->main + ) { + $repositories[] = array( + 'repo_name' => ($repo->main != $prev ? $repo->main : " "), + 'active' => ($repo->main != $prev ? + ($repo->active ? "<strong>Yes</strong>" : "no") : + " " + ), + 'sub_name' => $repo->sub, + 'url' => $repo->url, + 'date' => date("r", $repo->stamp) + ); + } + $smarty->assign('repositories', $repositories); + } } catch(PDOException $e) { -?> - <tr> - <td colspan="5"> -<?php - printf("%s ERREUR : %s\n", date("r"), $e->getMessage()); -?> - </td> - </tr> -<?php + $smarty->assign( + 'error', + sprintf("%s ERREUR : %s\n", date("r"), $e->getMessage()) + ); } -?> - </tbody> - </table><!-- /list-pacakges --> - - <h2>Script sources</h2> - <p>You can retrieve the current application sources from my GIT repository on github.com: <a href='http://github.com/remicollet/rpmphp'>http://github.com/remicollet/rpmphp</a>.</p> - <p>Feedbacks, RFE and patches are welcome.</p> - </div><!-- /fedora-content --> -<?php -include '_footer.php'; -?> - </div> - </body> -</html> - +$page_content = $smarty->fetch('index.tpl'); +$smarty->assign('page_content', $page_content); +$smarty->display('main.tpl'); +?>
\ No newline at end of file |