From cbd3c42f9d39f7d73c77cf811c7f65fce9cd1b55 Mon Sep 17 00:00:00 2001 From: "Johan \"Papa\" Cwiklinski" Date: Sat, 29 May 2010 22:44:10 +0200 Subject: Use of Smarty for index page ; apply coding standards, add license ; refs #46,48,47 --- index.php | 150 +++++++++++++++++++++++++++++--------------------------------- 1 file changed, 71 insertions(+), 79 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index c9136f4..f1ff7c3 100644 --- a/index.php +++ b/index.php @@ -1,85 +1,77 @@ - - - - Packages in Fedora - - - - - - - - -
- - -
-
-

You are here:

- -
-

Packages in Fedora repositories

-

Package reports

- - - - - - - - - - - - - . + * + * @category Main + * @package RPMPHP + * + * @author Remi Collet + * @author Johan Cwiklinski + * @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 ("\n", - ($i%2 ? 'odd' : 'even'), - ($repo->main != $prev ? $repo->main : " "), - ($repo->main != $prev ? ($repo->active ? "Yes" : "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 ? "Yes" : "no") : + " " + ), + 'sub_name' => $repo->sub, + 'url' => $repo->url, + 'date' => date("r", $repo->stamp) + ); + } + $smarty->assign('repositories', $repositories); + } } catch(PDOException $e) { -?> - - - -assign( + 'error', + sprintf("%s ERREUR : %s\n", date("r"), $e->getMessage()) + ); } -?> - -
Analysed repositories
MainActiveSubUrlLast update
%s%s%s%s%s
-getMessage()); -?> -
- -

Script sources

-

You can retrieve the current application sources from my GIT repository on github.com: http://github.com/remicollet/rpmphp.

-

Feedbacks, RFE and patches are welcome.

-
- -
- - - +$page_content = $smarty->fetch('index.tpl'); +$smarty->assign('page_content', $page_content); +$smarty->display('main.tpl'); +?> \ No newline at end of file -- cgit From caa9d9178232885b7e02aab8be94e01e438cc1d7 Mon Sep 17 00:00:00 2001 From: "Johan \"Papa\" Cwiklinski" Date: Sat, 29 May 2010 22:58:10 +0200 Subject: Wrong comment --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'index.php') diff --git a/index.php b/index.php index f1ff7c3..dc6f25a 100644 --- a/index.php +++ b/index.php @@ -3,7 +3,7 @@ /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** - * Display informations from a specific package + * Main page and repositories list * * PHP version 5 * -- cgit