summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tänzer <neo@nhng.de>2011-09-14 20:50:33 +0200
committerMichael Tänzer <neo@nhng.de>2011-09-14 20:50:33 +0200
commit93714fa661ce6473eacf48d343cd27a8a6c237e4 (patch)
tree775738f754aa01d4297d0e4a9b0e356efc7cce98
parent40f56dbfe7ca2fdcafdafc8be0bdf8423c5907a4 (diff)
downloadcacert-devel-93714fa661ce6473eacf48d343cd27a8a6c237e4.tar.gz
cacert-devel-93714fa661ce6473eacf48d343cd27a8a6c237e4.tar.xz
cacert-devel-93714fa661ce6473eacf48d343cd27a8a6c237e4.zip
bug 955: Allow for the strings to be translated and make the sort orderbug-955
handling more readable Signed-off-by: Michael Tänzer <neo@nhng.de>
-rwxr-xr-xpages/account/25.php46
1 files changed, 23 insertions, 23 deletions
diff --git a/pages/account/25.php b/pages/account/25.php
index a460ea0..a70f608 100755
--- a/pages/account/25.php
+++ b/pages/account/25.php
@@ -21,7 +21,11 @@
</tr>
<tr>
- <td colspan="5" class="title">Order by: <a href="account.php?id=25">Id</a> - <a href="account.php?id=25&amp;ord=1">Country</a> - <a href="account.php?id=25&amp;ord=2">Name</a></td>
+ <td colspan="5" class="title"><?=_("Order by:")?>
+ <a href="account.php?id=25"><?=_("Id")?></a> -
+ <a href="account.php?id=25&amp;ord=1"><?=_("Country")?></a> -
+ <a href="account.php?id=25&amp;ord=2"><?=_("Name")?></a>
+ </td>
</tr>
<tr>
@@ -32,28 +36,24 @@
<td class="DataTD"><?=_("Delete")?></td>
</tr>
<?
- $order = 0;
- if (array_key_exists('ord',$_REQUEST)) {
- if ( $_REQUEST['ord'] != '') {
- $order = intval($_REQUEST['ord']);
- }
- if($order>0 && $order<3) {
- if($order==1) {
- $query = "select * from `orginfo` ORDER BY `C`,`O`";
- } else {
- $query = "select * from `orginfo` ORDER BY `O`";
- }
- } else {
- $order=0;
- $query = "select * from `orginfo` ORDER BY `id`";
- }
- } else {
- $order=0;
- $query = "select * from `orginfo` ORDER BY `id`";
- }
-
-// echo "<tr><td colspan='5'>(".$order.") ".$query."</td></tr>\r\n";
-
+ $order = 0;
+ if (array_key_exists('ord',$_REQUEST)) {
+ $order = intval($_REQUEST['ord']);
+ }
+
+ $order_by = "`id`";
+ switch ($order) {
+ case 1:
+ $order_by = "`C`,`O`";
+ break;
+ case 2:
+ $order_by = "`O`";
+ break;
+ // the 0 and default case are handled by the preset
+ }
+
+ // Safe because $order_by only contains fixed strings
+ $query = sprintf("select * from `orginfo` ORDER BY %s", $order_by);
$res = mysql_query($query);
while($row = mysql_fetch_assoc($res))
{