Re: pecl4win patches
| From: | Richard Quadling | Date: | Tue, 29 May 2007 13:40:08 +0000 |
| Subject: | Re: pecl4win patches | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-29862@lists.php.net to get a copy of this message | ||
I've attached the patch for this.
On 25/05/07, Gaetano Giunta <giunta.gaetano@gmail.com> wrote:
> Please find here: http://gggeek.altervista.org/sw/pecl4win.zip
> a
> slightly improved version of the pecl4win pages:
>
> + allow sorting of columns in the DLLs page
> + more descriptive titles in the extensions list page for both search
> and single branch cases
>
> Sorry for not providing diffs - the full versions of the files are included
>
> Ideas for further improvement:
> + add table of all available branches in the extensions list page (one
> column per branch)
> + add compile log, date, size, in the extensions list page (when
> filtered by single branch)
> + other ?
>
> Bye
> Gaetano Giunta
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
Index: list.php =================================================================== RCS file: /repository/pecl4win/list.php,v retrieving revision 1.6 diff -u -r1.6 list.php --- list.php 22 Apr 2007 22:01:37 -0000 1.6 +++ list.php 29 May 2007 13:38:40 -0000 @@ -9,13 +9,14 @@ /* Are doing a search? */ -$in_search = false; +$in_search = ''; +$branch = ''; if (isset($_GET['search_string']) && strlen($_GET['search_string'])) { - $in_search = true; + $in_search = ' for ""' . htmlspecialchars($_GET['search_string']) . '"'; $arg = preg_split('|\\s+|', strtolower($_GET['search_string']), NULL, PREG_SPLIT_NO_EMPTY); $where = array(); - + foreach($arg as $a) { $where[] = safe_sql_str("lower(fname) like !s", "%" . $a . "%"); } @@ -27,6 +28,7 @@ if ($arg[0]) { $q .= safe_sql_str(" where branch=!s", $arg[0]); + $branch = ' for branch '.htmlspecialchars($arg[0]); } if ($arg[1]) { @@ -59,10 +61,10 @@ $layout->setTitle('The PECL Windows Repository'); $layout->header(); -if ($in_search) { - echo "<h2>Search result</h2>"; +if ($in_search != '') { + echo "<h2>Search results$in_search</h2>"; } else { - echo "<h2>Browse Extensions</h2>"; + echo "<h2>Browse Extensions$branch</h2>"; } ?> Index: list_dlls.php =================================================================== RCS file: /repository/pecl4win/list_dlls.php,v retrieving revision 1.2 diff -u -r1.2 list_dlls.php --- list_dlls.php 8 Nov 2005 15:06:18 -0000 1.2 +++ list_dlls.php 29 May 2007 13:38:40 -0000 @@ -5,7 +5,17 @@ } include SITE_ROOT."/lib/includes/init.php"; -$dlls = DLLs::getAll(); +/* Set sort order */ +if (isset($_GET['sort']) && $_GET['sort'] == "date") { + $sortq = "updated desc"; +} else { +if (isset($_GET['sort']) && $_GET['sort'] == "num") { + $sortq = "downloads desc"; +} else { + $sortq = "name"; +} + +$dlls = DLLs::getAll($sortq); $layout = new Layout(); $layout->setTitle('DLL Libraries'); @@ -15,11 +25,11 @@ <table id="packageList" border="0"> <tbody><tr> <th class="form-label_left">#</th> -<th class="form-label_left"><nobr>File name</nobr></th> +<th class="form-label_left"><a class="form-label_left" href="<?php echo $_SERVER['PHP_SELF'] ?>?sort=name"><nobr>File name</nobr></a></th> <th class="form-label_left">MD5 sum</th> -<th class="form-label_left">Last update</th> +<th class="form-label_left"><a class="form-label_left" href="<?php echo $_SERVER['PHP_SELF'] ?>?sort=date">Last update</a></th> <th class="form-label_left">Size (KB)</th> -<th class="form-label_left">Downloads</th> +<th class="form-label_left"><a class="form-label_left" href="<?php echo $_SERVER['PHP_SELF'] ?>?sort=num">Downloads</a></th> </tr> Index: lib/classes/DLLs.php =================================================================== RCS file: /repository/pecl4win/lib/classes/DLLs.php,v retrieving revision 1.2 diff -u -r1.2 DLLs.php --- lib/classes/DLLs.php 4 Oct 2006 08:54:24 -0000 1.2 +++ lib/classes/DLLs.php 29 May 2007 13:38:40 -0000 @@ -3,13 +3,16 @@ class DLLs { - public function getAll() + public function getAll($orderby = 'name') { global $DB; $ret = array(); - $q = "select name, md5hash, updated, filesize, downloads from dlls where row(name, updated) in (select name, max(updated) as updated from dlls group by name) order by name"; - + $q = "select name, md5hash, updated, filesize, downloads from dlls where row(name, updated) in (select name, max(updated) as updated from dlls group by name)"; + if ($orderby != '') { + $q .= ' order by ' . substr(safe_sql_str('!s', $orderby), 1, -1); + } + if (!$res = $DB->query($q)) { return $ret; }
Index: list.php =================================================================== RCS file: /repository/pecl4win/list.php,v retrieving revision 1.6 diff -u -r1.6 list.php --- list.php 22 Apr 2007 22:01:37 -0000 1.6 +++ list.php 29 May 2007 13:38:40 -0000 @@ -9,13 +9,14 @@ /* Are doing a search? */ -$in_search = false; +$in_search = ''; +$branch = ''; if (isset($_GET['search_string']) && strlen($_GET['search_string'])) { - $in_search = true; + $in_search = ' for ""' . htmlspecialchars($_GET['search_string']) . '"'; $arg = preg_split('|\\s+|', strtolower($_GET['search_string']), NULL, PREG_SPLIT_NO_EMPTY); $where = array(); - + foreach($arg as $a) { $where[] = safe_sql_str("lower(fname) like !s", "%" . $a . "%"); } @@ -27,6 +28,7 @@ if ($arg[0]) { $q .= safe_sql_str(" where branch=!s", $arg[0]); + $branch = ' for branch '.htmlspecialchars($arg[0]); } if ($arg[1]) { @@ -59,10 +61,10 @@ $layout->setTitle('The PECL Windows Repository'); $layout->header(); -if ($in_search) { - echo "<h2>Search result</h2>"; +if ($in_search != '') { + echo "<h2>Search results$in_search</h2>"; } else { - echo "<h2>Browse Extensions</h2>"; + echo "<h2>Browse Extensions$branch</h2>"; } ?> Index: list_dlls.php =================================================================== RCS file: /repository/pecl4win/list_dlls.php,v retrieving revision 1.2 diff -u -r1.2 list_dlls.php --- list_dlls.php 8 Nov 2005 15:06:18 -0000 1.2 +++ list_dlls.php 29 May 2007 13:38:40 -0000 @@ -5,7 +5,17 @@ } include SITE_ROOT."/lib/includes/init.php"; -$dlls = DLLs::getAll(); +/* Set sort order */ +if (isset($_GET['sort']) && $_GET['sort'] == "date") { + $sortq = "updated desc"; +} else { +if (isset($_GET['sort']) && $_GET['sort'] == "num") { + $sortq = "downloads desc"; +} else { + $sortq = "name"; +} + +$dlls = DLLs::getAll($sortq); $layout = new Layout(); $layout->setTitle('DLL Libraries'); @@ -15,11 +25,11 @@ <table id="packageList" border="0"> <tbody><tr> <th class="form-label_left">#</th> -<th class="form-label_left"><nobr>File name</nobr></th> +<th class="form-label_left"><a class="form-label_left" href="<?php echo $_SERVER['PHP_SELF'] ?>?sort=name"><nobr>File name</nobr></a></th> <th class="form-label_left">MD5 sum</th> -<th class="form-label_left">Last update</th> +<th class="form-label_left"><a class="form-label_left" href="<?php echo $_SERVER['PHP_SELF'] ?>?sort=date">Last update</a></th> <th class="form-label_left">Size (KB)</th> -<th class="form-label_left">Downloads</th> +<th class="form-label_left"><a class="form-label_left" href="<?php echo $_SERVER['PHP_SELF'] ?>?sort=num">Downloads</a></th> </tr> Index: lib/classes/DLLs.php =================================================================== RCS file: /repository/pecl4win/lib/classes/DLLs.php,v retrieving revision 1.2 diff -u -r1.2 DLLs.php --- lib/classes/DLLs.php 4 Oct 2006 08:54:24 -0000 1.2 +++ lib/classes/DLLs.php 29 May 2007 13:38:40 -0000 @@ -3,13 +3,16 @@ class DLLs { - public function getAll() + public function getAll($orderby = 'name') { global $DB; $ret = array(); - $q = "select name, md5hash, updated, filesize, downloads from dlls where row(name, updated) in (select name, max(updated) as updated from dlls group by name) order by name"; - + $q = "select name, md5hash, updated, filesize, downloads from dlls where row(name, updated) in (select name, max(updated) as updated from dlls group by name)"; + if ($orderby != '') { + $q .= ' order by ' . substr(safe_sql_str('!s', $orderby), 1, -1); + } + if (!$res = $DB->query($q)) { return $ret; }