cvs: docweb /include lib_general.inc.php /templates/all/www userlist.tpl.php /www users.php

[email protected] ("Nuno Lopes")
Newsgroups php.doc.web
Message-ID <cvsnlopess1123773938@cvsserver>
nlopess		Thu Aug 11 11:25:38 2005 EDT

  Added files:                 
    /docweb/templates/all/www	userlist.tpl.php 

  Modified files:              
    /docweb/include	lib_general.inc.php 
    /docweb/www	users.php 
  Log:
  add a user list and validate the $userid properly
  
http://cvs.php.net/diff.php/docweb/include/lib_general.inc.php?r1=1.49&r2=1.50&ty=u
Index: docweb/include/lib_general.inc.php
diff -u docweb/include/lib_general.inc.php:1.49 docweb/include/lib_general.inc.php:1.50
--- docweb/include/lib_general.inc.php:1.49	Thu Aug 11 06:23:59 2005
+++ docweb/include/lib_general.inc.php	Thu Aug 11 11:25:37 2005
@@ -18,7 +18,7 @@
 |                   Gabor Hojtsy <[email protected]>                        |
 |                   Sean Coates <[email protected]>                         |
 +----------------------------------------------------------------------+
-$Id: lib_general.inc.php,v 1.49 2005/08/11 10:23:59 mazzanet Exp $
+$Id: lib_general.inc.php,v 1.50 2005/08/11 15:25:37 nlopess Exp $
 */
 
 require_once dirname(__FILE__) . '/lib_auth.inc.php';
@@ -182,6 +182,7 @@
     $links = array(
         'subsite-homepage'      => BASE_URL .'/',
         'request-for-comments'  => BASE_URL .'/rfc/rfc-overview.php',
+        'userlist'              => BASE_URL .'/users.php',
     );
     if (strpos($_SERVER['REQUEST_URI'], 'rfc') !== false) {
         $links['submit-rfc'] = BASE_URL .'/rfc/rfc-proposal-edit.php';
http://cvs.php.net/diff.php/docweb/www/users.php?r1=1.7&r2=1.8&ty=u
Index: docweb/www/users.php
diff -u docweb/www/users.php:1.7 docweb/www/users.php:1.8
--- docweb/www/users.php:1.7	Thu Aug 11 10:48:35 2005
+++ docweb/www/users.php	Thu Aug 11 11:25:38 2005
@@ -1,10 +1,22 @@
 <?php
-/* $Id: users.php,v 1.7 2005/08/11 14:48:35 vincent Exp $ */
+/* $Id: users.php,v 1.8 2005/08/11 15:25:38 nlopess Exp $ */
 
 include '../include/init.inc.php';
 require_once '../include/lib_auth.inc.php';
 
-if(empty($userid) || !is_string($userid)) {
+// show the users list
+if (empty($userid)) {
+    $q = sqlite_query('SELECT * FROM users ORDER BY username', $idx);
+    $data = sqlite_fetch_all($q, SQLITE_ASSOC);
+
+    echo site_header('docweb.common.header.users');
+    echo DocWeb_Template::get('userlist.tpl.php');
+    echo site_footer();
+    exit;
+}
+
+
+if(!is_string($userid) || !ctype_alnum($userid)) {
         echo site_header('docweb.common.header.users');
         echo '<h3>No such user found</h3>';
         echo site_footer();

http://cvs.php.net/co.php/docweb/templates/all/www/userlist.tpl.php?r=1.1&p=1
Index: docweb/templates/all/www/userlist.tpl.php
+++ docweb/templates/all/www/userlist.tpl.php
<?php
global $data;

echo <<< HTML
<table border="1">
 <tr>
  <td>&docweb.users.username;</td>
  <td>&docweb.users.name;</td>
  <td>&docweb.users.country;</td>
 </tr>
HTML;


foreach ($data as $user) {

    $user['country'] = empty($user['country']) ? '&nbsp;' : $user['country'];

    echo <<< HTML
 <tr>
  <td><a href="/user/$user[username]">$user[username]</a></td>
  <td>$user[name]</td>
  <td>$user[country]</td>
 </tr>
HTML;

}

echo '</table>';
?>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.