summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcanyonknight <canyonknight@gmail.com>2012-05-23 13:53:33 -0400
committerLukas Fleischer <archlinux@cryptocrack.de>2012-07-06 11:26:31 +0200
commitf78d46c65420e7b1ea6f22b73ce427902ce2810c (patch)
treefad00a3a93cfc766b16c1849ce821bcb0a0da4ff
parent13b892e923b09e1f26d752b1e96a7fdf295a6a56 (diff)
downloadaurweb-f78d46c65420e7b1ea6f22b73ce427902ce2810c.tar.xz
acctfuncs.inc.php: Move XHTML to account_edit_form.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_edit_form.php Signed-off-by: canyonknight <canyonknight@gmail.com> Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
-rw-r--r--web/lib/acctfuncs.inc.php124
-rw-r--r--web/template/account_edit_form.php138
2 files changed, 139 insertions, 123 deletions
diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php
index da10f32..034bc48 100644
--- a/web/lib/acctfuncs.inc.php
+++ b/web/lib/acctfuncs.inc.php
@@ -46,129 +46,7 @@ function display_account_form($UTYPE,$A,$U="",$T="",$S="",
global $SUPPORTED_LANGS;
- print "<form action='account.php' method='post'>\n";
- print "<fieldset>";
- print "<input type='hidden' name='Action' value='".$A."' />\n";
- if ($UID) {
- print "<input type='hidden' name='ID' value='".$UID."' />\n";
- }
- print "</fieldset>";
- print "<table>\n";
- print "<tr><td colspan='2'>&nbsp;</td></tr>\n";
-
- print "<tr>";
- print "<td align='left'>".__("Username").":</td>";
- print "<td align='left'><input type='text' size='30' maxlength='64'";
- print " name='U' value='".htmlspecialchars($U,ENT_QUOTES)."' /> (".__("required").")</td>";
- print "</tr>\n";
-
- # Only TUs or Devs can promote/demote/suspend a user
- if ($UTYPE == "Trusted User" || $UTYPE == "Developer") {
- print "<tr>";
- print "<td align='left'>".__("Account Type").":</td>";
- print "<td align='left'><select name=T>\n";
- print "<option value='1'";
- $T == "User" ? print " selected>" : print ">";
- print __("Normal user")."\n";
- print "<option value='2'";
- $T == "Trusted User" ? print " selected>" : print ">";
- print __("Trusted user")."\n";
-
- # Only developers can make another account a developer
- if ($UTYPE == "Developer") {
- print "<option value='3'";
- $T == "Developer" ? print " selected>" : print ">";
- print __("Developer")."\n";
- }
- print "</select></td>";
- print "</tr>\n";
-
- print "<tr>";
- print "<td align='left'>".__("Account Suspended").":</td>";
- print "<td align='left'><input type='checkbox' name='S'";
- if ($S) {
- print " checked=\"checked\" />";
- } else {
- print " />";
- }
- print "</tr>\n";
- }
-
- print "<tr>";
- print "<td align='left'>".__("Email Address").":</td>";
- print "<td align='left'><input type='text' size='30' maxlength='64'";
- print " name='E' value='".htmlspecialchars($E,ENT_QUOTES)."' /> (".__("required").")</td>";
- print "</tr>\n";
-
- print "<tr>";
- print "<td align='left'>".__("Password").":</td>";
- print "<td align='left'><input type='password' size='30' maxlength='32'";
- print " name='P' value='".$P."' />";
- if ($A != "UpdateAccount") {
- print " (".__("required").")";
- }
- print "</td></tr>\n";
-
- print "<tr>";
- print "<td align='left'>".__("Re-type password").":</td>";
- print "<td align='left'><input type='password' size='30' maxlength='32'";
- print " name='C' value='".$C."' />";
- if ($A != "UpdateAccount") {
- print " (".__("required").")";
- }
- print "</td></tr>\n";
-
- print "<tr>";
- print "<td align='left'>".__("Real Name").":</td>";
- print "<td align='left'><input type='text' size='30' maxlength='32'";
- print " name='R' value='".htmlspecialchars($R,ENT_QUOTES)."' /></td>";
- print "</tr>\n";
-
- print "<tr>";
- print "<td align='left'>".__("IRC Nick").":</td>";
- print "<td align='left'><input type='text' size='30' maxlength='32'";
- print " name='I' value='".htmlspecialchars($I,ENT_QUOTES)."' /></td>";
- print "</tr>\n";
-
- print "<tr>";
- print "<td align='left'>".__("PGP Key Fingerprint").":</td>";
- print "<td align='left'><input type='text' size='30' maxlength='50'";
- print " name='K' value='".html_format_pgp_fingerprint($K)."' /></td>";
- print "</tr>\n";
-
- print "<tr>";
- print "<td align='left'>".__("Language").":</td>";
- print "<td align='left'><select name=L>\n";
-
- reset($SUPPORTED_LANGS);
- while (list($code, $lang) = each($SUPPORTED_LANGS)) {
- if ($L == $code) {
- print "<option value=".$code." selected> ".$lang."\n";
- } else {
- print "<option value=".$code."> ".$lang."\n";
- }
- }
- print "</select></td>";
- print "</tr>\n";
-
- print "<tr><td colspan='2'>&nbsp;</td></tr>\n";
- print "<tr>";
- print "<td>&nbsp;</td>";
- print "<td align='left'>";
-
- if ($A == "UpdateAccount") {
- print "<input type='submit' class='button'";
- print " value='".__("Update")."' /> &nbsp; ";
- } else {
- print "<input type='submit' class='button'";
- print " value='".__("Create")."' /> &nbsp; ";
- }
- print "<input type='reset' class='button' value='".__("Reset")."' />";
- print "</td>";
- print "</tr>\n";
-
- print "</table>\n";
- print "</form>\n";
+ include("account_edit_form.php");
return;
} # function display_account_form()
diff --git a/web/template/account_edit_form.php b/web/template/account_edit_form.php
new file mode 100644
index 0000000..32379a7
--- /dev/null
+++ b/web/template/account_edit_form.php
@@ -0,0 +1,138 @@
+<form action="account.php" method="post">
+ <fieldset>
+ <input type="hidden" name="Action" value="<?php echo $A ?>" />
+ <?php if ($UID): ?>
+ <input type="hidden" name="ID" value="<?php echo $UID ?>" />
+ <?php endif; ?>
+ </fieldset>
+ <table>
+ <tr>
+ <td colspan="2">&nbsp;</td>
+ </tr>
+
+ <tr>
+ <td align="left"><?php echo __("Username") ?>:</td>
+ <td align="left"><input type="text" size="30" maxlength="64" name="U" value="<?php echo htmlspecialchars($U,ENT_QUOTES) ?>" /> (<?php echo __("required") ?>)</td>
+ </tr>
+ <?php
+ # Only TUs or Devs can promote/demote/suspend a user
+ if ($UTYPE == "Trusted User" || $UTYPE == "Developer"):
+ ?>
+ <tr>
+ <td align="left"><?php echo __("Account Type") ?>:</td>
+ <td align="left">
+ <select name=T>
+ <?php if ($T == "User"): ?>
+ <option value="1" selected><?php echo __("Normal user") ?>
+ <?php else: ?>
+ <option value="1"><?php echo __("Normal user") ?>
+ <?php endif; ?>
+ <?php if ($T == "Trusted User"): ?>
+ <option value="2" selected><?php echo __("Trusted user") ?>
+ <?php else: ?>
+ <option value="2"><?php echo __("Trusted user") ?>
+ <?php endif; ?>
+ <?php
+ # Only developers can make another account a developer
+ if ($UTYPE == "Developer"):
+ ?>
+ <option value="3"
+ <?php $T == "Developer" ? print " selected>" : print ">";
+ print __("Developer")."\n"; ?>
+ <?php endif; ?>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="left"><?php echo __("Account Suspended") ?>:</td>
+
+ <?php if ($S): ?>
+ <td align="left"><input type="checkbox" name="S" checked="checked" />
+ <?php else: ?>
+ <td align="left"><input type="checkbox" name="S" />
+ <?php endif; ?>
+ </tr>
+ <?php endif; ?>
+
+ <tr>
+ <td align="left"><?php echo __("Email Address") ?>:</td>
+ <td align="left"><input type="text" size="30" maxlength="64" name="E" value="<?php echo htmlspecialchars($E,ENT_QUOTES) ?>" /> (<?php echo __("required") ?>)</td>
+ </tr>
+
+ <tr>
+ <td align="left"><?php echo __("Password") ?>:</td>
+ <td align="left">
+ <input type="password" size="30" maxlength="32" name="P" value="<?php echo $P ?>" />
+ <?php if ($A != "UpdateAccount"):
+ print " (".__("required").")";
+ endif; ?>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="left"><?php echo __("Re-type password") ?>:</td>
+ <td align="left">
+ <input type="password" size="30" maxlength="32" name="C" value="<?php echo $C ?>" />
+ <?php if ($A != "UpdateAccount"):
+ print " (".__("required").")";
+ endif; ?>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="left"><?php echo __("Real Name") ?>:</td>
+ <td align="left">
+ <input type="text" size="30" maxlength="32" name="R" value="<?php echo htmlspecialchars($R,ENT_QUOTES) ?>" />
+ </td>
+ </tr>
+
+ <tr>
+ <td align="left"><?php echo __("IRC Nick") ?>:</td>
+ <td align="left">
+ <input type="text" size="30" maxlength="32" name="I" value="<?php echo htmlspecialchars($I,ENT_QUOTES) ?>" />
+ </td>
+ </tr>
+
+ <tr>
+ <td align="left"><?php echo __("PGP Key Fingerprint") ?>:</td>
+<td align="left">
+ <input type="text" size="30" maxlength="50" name="K" value="<?php echo html_format_pgp_fingerprint($K) ?>" />
+ </td>
+ </tr>
+
+ <tr>
+ <td align="left"><?php echo __("Language") ?>:</td>
+ <td align="left">
+ <select name=L>
+<?php
+ reset($SUPPORTED_LANGS);
+ while (list($code, $lang) = each($SUPPORTED_LANGS)) {
+ if ($L == $code) {
+ print "<option value=".$code." selected> ".$lang."\n";
+ } else {
+ print "<option value=".$code."> ".$lang."\n";
+ }
+ }
+?>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">&nbsp;</td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ <td align="left">
+ <?php if ($A == "UpdateAccount"): ?>
+ <input type="submit" class="button" value="<?php echo __("Update") ?>" /> &nbsp;
+ <?php else: ?>
+ <input type="submit" class="button" value="<?php echo __("Create") ?>" /> &nbsp;
+ <?php endif; ?>
+ <input type="reset" class="button" value="<?php echo __("Reset") ?>" />
+ </td>
+ </tr>
+
+ </table>
+</form>