cvs: pearweb /public_html accounts.php

From: Date: Wed, 02 Apr 2008 22:14:45 +0000
Subject: cvs: pearweb /public_html accounts.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-7430@lists.php.net to get a copy of this message
dufuz Wed Apr 2 22:14:45 2008 UTC Modified files: /pearweb/public_html accounts.php Log: Quick and dirty hack to show only people with pear.dev karma ... I will improve upon this http://cvs.php.net/viewvc.cgi/pearweb/public_html/accounts.php?r1=1.27&r2=1.28&diff_format=u Index: pearweb/public_html/accounts.php diff -u pearweb/public_html/accounts.php:1.27 pearweb/public_html/accounts.php:1.28 --- pearweb/public_html/accounts.php:1.27 Wed Apr 2 21:56:44 2008 +++ pearweb/public_html/accounts.php Wed Apr 2 22:14:45 2008 @@ -15,7 +15,7 @@ +----------------------------------------------------------------------+ | Authors: | +----------------------------------------------------------------------+ - $Id: accounts.php,v 1.27 2008/04/02 21:56:44 dufuz Exp $ + $Id: accounts.php,v 1.28 2008/04/02 22:14:45 dufuz Exp $ */ response_header("Accounts"); @@ -32,7 +32,7 @@ $all_firstletters = $dbh->getCol($query); // I wish there was a way to do this in mysql... $first_letter_offsets = array(); -for ($i = 0; $i < sizeof($all_firstletters); $i++) { +for ($i = 0; $i < count($all_firstletters); $i++) { $l = $all_firstletters[$i]; if (isset($first_letter_offsets[$l])) { continue; @@ -52,7 +52,11 @@ } settype($offset, "integer"); -$naccounts = $dbh->getOne("SELECT COUNT(handle) FROM users WHERE registered = 1"); +$sql = ' + SELECT COUNT(u.handle) FROM users u + LEFT JOIN karma k ON k.user = u.handle + WHERE u.registered = 1 AND k.level = ?'; +$naccounts = $dbh->getOne($sql, array('pear.dev')); $last_shown = $offset + $page_size - 1; @@ -94,9 +98,11 @@ printf("Displaying accounts %d - %d of %d<br />\n", $offset, min($offset+$show, $naccounts), $naccounts); -$sth = $dbh->limitQuery('SELECT handle,name,email,homepage,showemail '. - 'FROM users WHERE registered = 1 ORDER BY handle', - $offset, $show); +$sql = 'SELECT u.handle, name, u.email, u.homepage, u.showemail '. + 'FROM users u + LEFT JOIN karma k ON k.user = u.handle + WHERE u.registered = 1 AND k.level = "pear.dev" ORDER BY handle'; +$sth = $dbh->limitQuery($sql, $offset, $show); echo "</td></tr></table>\n"; echo "</th>\n";

« previous php.pear.core (#7430) next »