[aur-dev] [PATCH] voters.php: Remove extra call to pkgname_from_id()

Lukas Fleischer archlinux at cryptocrack.de
Mon Jan 20 09:39:51 EST 2014


On Mon, 20 Jan 2014 at 02:27:49, canyonknight wrote:
> No need to store package ID and call pkgname_from_id() twice when
> the end goal is the package name.
> 
> Signed-off-by: canyonknight <canyonknight at gmail.com>
> ---
>  web/html/voters.php | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 

Good catch. Merged, thanks!

> diff --git a/web/html/voters.php b/web/html/voters.php
> index 9cedeef..42fe2b5 100644
> --- a/web/html/voters.php
> +++ b/web/html/voters.php
> @@ -4,8 +4,7 @@ include_once('aur.inc.php');
>  include_once('pkgfuncs.inc.php');
>  
>  $SID = $_COOKIE['AURSID'];
> -
> -$pkgid = intval($_GET['ID']);
> +$pkgname = pkgname_from_id(intval($_GET['ID']);
>  $votes = getvotes($pkgid);
>  $atype = account_from_sid($SID);
>  
> @@ -15,7 +14,7 @@ if ($atype == 'Trusted User' || $atype== 'Developer'):
>  ?>
>  
>  <div class="box">
> -       <h2>Votes for <a href="<?= get_pkg_uri(pkgname_from_id($pkgid)); ?>"><?= pkgname_from_id($pkgid) ?></a></h2>
> +       <h2>Votes for <a href="<?= get_pkg_uri($pkgname); ?>"><?= $pkgname ?></a></h2>
>         <div class="boxbody">
>                 <ul>
>                         <?php while (list($indx, $row) = each($votes)): ?>
> -- 
> 1.8.5.3
> 


More information about the aur-dev mailing list