summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorcanyonknight <canyonknight@gmail.com>2012-05-23 13:56:15 -0400
committerLukas Fleischer <archlinux@cryptocrack.de>2012-07-06 11:26:34 +0200
commitbe0cf7f41f6939371c780a25732e88c1cbad4a3b (patch)
treee6ba16bae92c6bde057692cbfba646ddd034c2ac /web
parentf78d46c65420e7b1ea6f22b73ce427902ce2810c (diff)
downloadaurweb-be0cf7f41f6939371c780a25732e88c1cbad4a3b.tar.xz
acctfuncs.inc.php: Move XHTML to account_search_results.php template
XHTML should be eliminated from lib/ as much as possible. This pulls the XHTML out of a function that simply echoes the code, and moves it into a more reasonable template file in account_search_results.php Signed-off-by: canyonknight <canyonknight@gmail.com> Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web')
-rw-r--r--web/lib/acctfuncs.inc.php116
-rw-r--r--web/template/account_search_results.php103
2 files changed, 104 insertions, 115 deletions
diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php
index 034bc48..9e50cfd 100644
--- a/web/lib/acctfuncs.inc.php
+++ b/web/lib/acctfuncs.inc.php
@@ -323,121 +323,7 @@ function search_results_page($UTYPE,$O=0,$SB="",$U="",$T="",
$dbh = db_connect();
$result = db_query($q, $dbh);
- if (!$result) {
- print __("No results matched your search criteria.");
- } else {
- $num_rows = mysql_num_rows($result);
- if ($num_rows) {
- print "<table class='results'>\n";
- print "<tr>";
- print "<th class='header'>";
- print "<span class='f2'>".__("Username")."</span></th>";
- print "<th class='header'>";
- print "<span class='f2'>".__("Type")."</span></th>";
- print "<th class='header'>";
- print "<span class='f2'>".__("Status")."</span></th>";
- print "<th class='header'>";
- print "<span class='f2'>".__("Real Name")."</span></th>";
- print "<th class='header'>";
- print "<span class='f2'>".__("IRC Nick")."</span></th>";
- print "<th class='header'>";
- print "<span class='f2'>".__("PGP Key Fingerprint")."</span></th>";
- print "<th class='header'>";
- print "<span class='f2'>".__("Last Voted")."</span></th>";
- print "<th class='header'>";
- print "<span class='f2'>".__("Edit Account")."</span></th>";
- print "</tr>\n";
- $i = 0;
- while ($row = mysql_fetch_assoc($result)) {
- if ($i % 2) {
- $c = "data1";
- } else {
- $c = "data2";
- }
- print "<tr>";
- print "<td class='".$c."'>";
- print "<span class='f5'><a href='packages.php?SeB=m&amp;K=".$row["Username"]."'>".$row["Username"]."</a></span></td>";
- print "<td class='".$c."'>";
- print "<span class='f5'>".$row["AccountType"];
- print "</span></td>";
- print "<td class='".$c."'><span class='f5'>";
- if ($row["Suspended"]) {
- print __("Suspended");
- } else {
- print __("Active");
- }
- print "</span></td>";
- print "<td class='".$c."'><span class='f5'>";
- $row["RealName"] ? print htmlspecialchars($row["RealName"],ENT_QUOTES) : print "&nbsp;";
- print "</span></td>";
- print "<td class='".$c."'><span class='f5'>";
- $row["IRCNick"] ? print htmlspecialchars($row["IRCNick"],ENT_QUOTES) : print "&nbsp;";
- print "</span></td>";
- print "<td class='".$c."'><span class='f5'>";
- $row["PGPKey"] ? print html_format_pgp_fingerprint($row["PGPKey"]) : print "&nbsp;";
- print "</span></td>";
- print "<td class='".$c."'><span class='f5'>";
- $row["LastVoted"]
- ? print date("Y-m-d", $row["LastVoted"])
- : print __("Never");
- print "</span></td>";
- print "<td class='".$c."'><span class='f5'>";
- if ($UTYPE == "Trusted User" && $row["AccountType"] == "Developer") {
- # TUs can't edit devs
- #
- print "&nbsp;</span></td>";
- } else {
- $edit_url = "account.php?Action=DisplayAccount&amp;ID=".$row["ID"];
- print "<a href='".$edit_url . "'>";
- print "Edit</a></span></td>";
- }
- print "</tr>\n";
- $i++;
- }
- print "</table>\n";
-
- print "<table class='results'>\n";
- print "<tr>";
- print "<td align='left'>";
- print "<form action='account.php' method='post'>\n";
- print "<fieldset>";
- print "<input type='hidden' name='Action' value='SearchAccounts' />\n";
- print "<input type='hidden' name='O'";
- print " value='".($OFFSET-$HITS_PER_PAGE)."' />\n";
- reset($search_vars);
- while (list($k, $ind) = each($search_vars)) {
- print "<input type='hidden' name='".$ind."'";
- print " value='".${$ind}."' />\n";
- }
- print "<input type='submit' class='button'";
- print " value='&lt;-- ".__("Less")."' />";
- print "</fieldset>";
- print "</form>\n";
- print "</td>";
- print "<td align='right'>";
- print "<form action='account.php' method='post'>\n";
- print "<fieldset>";
- print "<input type='hidden' name='Action' value='SearchAccounts' />\n";
- print "<input type='hidden' name='O'";
- print " value='".($OFFSET+$HITS_PER_PAGE)."' />\n";
- reset($search_vars);
- while (list($k, $ind) = each($search_vars)) {
- print "<input type='hidden' name='".$ind."'";
- print " value='".${$ind}."' />\n";
- }
- print "<input type='submit' class='button'";
- print " value='".__("More")." --&gt;' />";
- print "</fieldset>";
- print "</form>\n";
- print "</td>";
- print "</tr>\n";
- print "</table>\n";
- } else {
- print "<p style=\"text-align:center;\">\n";
- print __("No more results to display.");
- print "</p>\n";
- }
- }
+ include("account_search_results.php");
return;
}
diff --git a/web/template/account_search_results.php b/web/template/account_search_results.php
new file mode 100644
index 0000000..88d6bb6
--- /dev/null
+++ b/web/template/account_search_results.php
@@ -0,0 +1,103 @@
+<?php
+if (!$result):
+ print __("No results matched your search criteria.");
+else:
+ $num_rows = mysql_num_rows($result);
+ if ($num_rows):
+?>
+ <table class="results">
+ <thead>
+ <tr>
+ <th><?php echo __("Username") ?></th>
+ <th><?php echo __("Type") ?></th>
+ <th><?php echo __("Status") ?></th>
+ <th><?php echo __("Real Name") ?></th>
+ <th><?php echo __("IRC Nick") ?></th>
+ <th><?php echo __("PGP Key Fingerprint") ?></th>
+ <th><?php echo __("Last Voted") ?></th>
+ <th><?php echo __("Edit Account") ?></th>
+ </tr>
+ </thead>
+ <?php
+ $i = 0;
+ while ($row = mysql_fetch_assoc($result)):
+ if ($i % 2):
+ $c = "even";
+ else:
+ $c = "odd";
+ endif;
+ ?>
+ <tbody>
+ <tr class ="<?php echo $c ?>">
+ <td><a href="packages.php?SeB=m&amp;K=<?php echo $row["Username"] ?>"><?php echo $row["Username"] ?></a></td>
+ <td><?php echo $row["AccountType"] ?></td>
+ <td>
+ <?php
+ if ($row["Suspended"]):
+ print __("Suspended");
+ else:
+ print __("Active");
+ endif;
+ ?>
+ </td>
+ <td><?php $row["RealName"] ? print htmlspecialchars($row["RealName"],ENT_QUOTES) : print "&nbsp;" ?></td>
+ <td><?php $row["IRCNick"] ? print htmlspecialchars($row["IRCNick"],ENT_QUOTES) : print "&nbsp;" ?></td>
+ <td><?php $row["PGPKey"] ? print html_format_pgp_fingerprint($row["PGPKey"]) : print "&nbsp;" ?></td>
+ <td><?php $row["LastVoted"] ? print date("Y-m-d", $row["LastVoted"]) : print __("Never") ?></td>
+ <td>
+ <?php
+ if ($UTYPE == "Trusted User" && $row["AccountType"] == "Developer"):
+ # TUs can't edit devs
+ print "&nbsp;";
+ else:
+ ?>
+ <a href="account.php?Action=DisplayAccount&amp;ID=<?php echo $row["ID"] ?>"><?php echo __("Edit") ?></a>
+ <?php endif; ?>
+ </td>
+ </tr>
+ <?php
+ $i++;
+ endwhile;
+ ?>
+ </table>
+
+ <table class="results">
+ <tr>
+ <td align="left">
+ <form action="account.php" method="post">
+ <fieldset>
+ <input type="hidden" name="Action" value="SearchAccounts" />
+ <input type="hidden" name="O" value="<?php echo ($OFFSET-$HITS_PER_PAGE) ?>" />
+ <?php
+ reset($search_vars);
+ while (list($k, $ind) = each($search_vars)):
+ ?>
+ <input type="hidden" name="<?php echo $ind ?>" value="<?php echo ${$ind} ?>" />
+ <?php endwhile; ?>
+ <input type="submit" class="button" value="&lt;-- <?php echo __("Less") ?>" />
+ </fieldset>
+ </form>
+ </td>
+ <td align="right">
+ <form action="account.php" method="post">
+ <fieldset>
+ <input type="hidden" name="Action" value="SearchAccounts" />
+ <input type="hidden" name="O" value="<?php echo ($OFFSET+$HITS_PER_PAGE) ?>" />
+ <?php
+ reset($search_vars);
+ while (list($k, $ind) = each($search_vars)):
+ ?>
+ <input type="hidden" name="<?php echo $ind ?>" value="<?php echo ${$ind} ?>" />
+ <?php endwhile; ?>
+ <input type="submit" class="button" value="<?php echo __("More") ?> --&gt;" />
+ </fieldset>
+ </form>
+ </td>
+ </tr>
+ </table>
+ <?php else: ?>
+ <p style="text-align:center;">
+ <?php print __("No more results to display."); ?>
+ </p>
+ <?php endif; ?>
+<?php endif; ?>