PEAR Coding Standards intermediate update for files changed
[phorkie.git] / www / list.php
1 <?php
2 /**
3  * List a repository
4  */
5 namespace phorkie;
6 require_once 'www-header.php';
7 if ($GLOBALS['phorkie']['auth']['secure'] == 2) {
8     include_once 'secure.php';
9 }
10 $rs = new Repositories();
11
12 $page = 0;
13 if (isset($_GET['page'])) {
14     if (!is_numeric($_GET['page'])) {
15         throw new Exception_Input('List page is not numeric');
16     }
17     $page = (int)$_GET['page'] - 1;
18 }
19
20 $perPage = 10;
21 list($repos, $repoCount) = $rs->getList($page, $perPage);
22
23 $pager = new Html_Pager(
24     $repoCount, $perPage, $page + 1, '/list/%d'
25 );
26
27 render(
28     'list',
29     array(
30         'repos' => $repos,
31         'pager' => $pager,
32     )
33 );
34 ?>