com web/master: show user notes in unapproved users table: include/functions.inc manage/users.php
| From: | Peter Cowburn | Date: | Fri, 08 Dec 2017 15:22:15 +0000 |
| Subject: | com web/master: show user notes in unapproved users table: include/functions.inc manage/users.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-26634@lists.php.net to get a copy of this message | ||
Commit: 2d25c62a33e68a222e93e496002fad4088ad83f5
Author: Peter Cowburn <salathe@php.net> Fri, 8 Dec 2017 15:21:02 +0000
Parents: 41d06c03f9d171f7860efd2cd7b88c98a6fe38c4
Branches: master
Link: http://git.php.net/?p=web/master.git;a=commitdiff;h=2d25c62a33e68a222e93e496002fad4088ad83f5
Log:
show user notes in unapproved users table
Also replaced old-school <script language="php"> tags with <?php tags in
users.php
Changed paths:
M include/functions.inc
M manage/users.php
Diff:
diff --git a/include/functions.inc b/include/functions.inc
index b988e1b..5ea2be1 100644
--- a/include/functions.inc
+++ b/include/functions.inc
@@ -171,7 +171,7 @@ function show_prev_next($begin, $rows, $skip, $total, $extra = array(), $table =
<?php if($table): ?>
<td>
<?php else: ?>
- <td colspan="2">
+ <td colspan="4">
<?php endif; ?>
<?php echo "Displaying ",$begin+1,"-",$begin+$rows," of
$total";?>
</td>
diff --git a/manage/users.php b/manage/users.php
index 21cd5d7..b5e1ff1 100644
--- a/manage/users..php
+++ b/manage/users.php
@@ -275,9 +275,9 @@ if ($id) {
</tfoot>
</table>
</form>
-<script language="php">
+<?php
if (is_admin($_SESSION["username"]) && !$userdata['cvsaccess']) {
-</script>
+?>
<table>
<tr>
<td>
@@ -300,9 +300,9 @@ if (is_admin($_SESSION["username"]) &&
!$userdata['cvsaccess']) {
</td>
</tr>
</table>
-<script language="php">
+<?php
}
-</script>
+?>
<h2 id="notes">Notes:</h2>
<?php
$res = db_query("SELECT note, UNIX_TIMESTAMP(entered) AS ts FROM users_note WHERE
userid=$id");
@@ -322,7 +322,9 @@ $forward = filter_input(INPUT_GET, "forward", FILTER_VALIDATE_INT)
?: 0;
$search = filter_input(INPUT_GET, "search", FILTER_CALLBACK,
array("options" => "mysql_real_escape_string")) ?: "";
$order = filter_input(INPUT_GET, "order", FILTER_CALLBACK, array("options"
=> "mysql_real_escape_string")) ?: "";
-$query = "SELECT DISTINCT SQL_CALC_FOUND_ROWS users.userid,cvsaccess,username,name,email FROM
users ";
+$query = "SELECT DISTINCT SQL_CALC_FOUND_ROWS
users.userid,cvsaccess,username,name,email,GROUP_CONCAT(note) note FROM users ";
+$query .= " LEFT JOIN users_note ON users_note.userid = users.userid ";
+
if ($search) {
$query .= "WHERE (MATCH(name,email,username) AGAINST ('$search') OR username =
'$search') ";
@@ -334,6 +336,8 @@ if ($unapproved) {
$query .= ' AND NOT cvsaccess ';
}
+$query .= " GROUP BY users.userid ";
+
if ($order) {
if ($forward) {
$ext = "ASC";
@@ -371,26 +375,30 @@ $extra = array(
<tbody>
<tr>
<th><a href="?<?php echo
array_to_url($extra,array("unapproved"=>!$unapproved));?>"><?php echo
$unapproved ? "&otimes" : "&oplus"; ?>;</a></th>
+ <th><a href="?<?php echo
array_to_url($extra,array("order"=>"username"));?>">username</a></th>
<th><a href="?<?php echo
array_to_url($extra,array("order"=>"name"));?>">name</a></th>
- <th><a href="?<?php echo
array_to_url($extra,array("order"=>"email"));?>">email</a></th>
<?php if (!$unapproved) { ?>
- <th><a href="?<?php echo
array_to_url($extra,array("order"=>"username"));?>">username</a></th>
+ <th colspan="2"><a href="?<?php echo
array_to_url($extra,array("order"=>"email"));?>">email</a></th>
<?php } else { ?>
- <th> </th>
+ <th><a href="?<?php echo
array_to_url($extra,array("order"=>"email"));?>">email</a></th>
+ <th><a href="?<?php echo
array_to_url($extra,array("order"=>"note"));?>">note</a></th>
<?php } ?>
+ <th> </th>
</tr>
<?php
while ($userdata = mysql_fetch_array($res)) {
?>
<tr class="<?php if (!$userdata["cvsaccess"]) { echo "noaccess";
}?>">
<td><a href="?username=<?php echo
$userdata["username"];?>">edit</a></td>
- <td><?php echo $userdata['name'];?></td>
- <td><?php echo $userdata['email'];?></td>
-<?php if (!$unapproved) { ?>
<td><a href="https://people.php.net/?username=<?php echo
hscr($userdata['username'])?>"><?php echo
hscr($userdata['username']) ?></a></td>
+ <td><?php echo hscr($userdata['name']);?></td>
+<?php if (!$unapproved) { ?>
+ <td colspan="2"><?php echo
hscr($userdata['email']);?></td>
<?php } else { ?>
- <td> </td>
+ <td><?php echo hscr($userdata['email']);?></td>
+ <td><?php echo hscr($userdata['note'])?></td>
<?php } ?>
+ <td> </td>
</tr>
<?php
}