summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2014-06-15 19:24:50 +0200
committerBenny Baumann <BenBE@geshi.org>2014-06-15 19:24:50 +0200
commitf50ec8665f09a396dd805dad8af6a371ca2c01a7 (patch)
tree612beee2c030685884725765f5a17769924217f2
parentd780e47b5d74673def0a11f534605bed914e8ed3 (diff)
parentba462bd60c71b779b43bd475247a906ddbf8fc35 (diff)
downloadcacert-devel-f50ec8665f09a396dd805dad8af6a371ca2c01a7.tar.gz
cacert-devel-f50ec8665f09a396dd805dad8af6a371ca2c01a7.tar.xz
cacert-devel-f50ec8665f09a396dd805dad8af6a371ca2c01a7.zip
Merge branch 'bug-657' into testserver-stable
Conflicts: includes/notary.inc.php
-rw-r--r--includes/account.php4
-rw-r--r--includes/notary.inc.php117
-rw-r--r--pages/account/24.php62
-rw-r--r--pages/account/27.php50
4 files changed, 149 insertions, 84 deletions
diff --git a/includes/account.php b/includes/account.php
index 0285aa9..6061d16 100644
--- a/includes/account.php
+++ b/includes/account.php
@@ -2260,7 +2260,7 @@ function buildSubjectFromSession() {
`contact`='".$_SESSION['_config']['contact']."',
`L`='".$_SESSION['_config']['L']."',
`ST`='".$_SESSION['_config']['ST']."',
- `C`='".$_SESSION['_config']['C']."',
+ `C`='".strtoupper($_SESSION['_config']['C'])."',
`comments`='".$_SESSION['_config']['comments']."'");
showheader(_("My CAcert.org Account!"));
printf(_("'%s' has just been successfully added as an organisation to the database."), sanitizeHTML($_SESSION['_config']['O']));
@@ -2288,7 +2288,7 @@ function buildSubjectFromSession() {
`contact`='".$_SESSION['_config']['contact']."',
`L`='".$_SESSION['_config']['L']."',
`ST`='".$_SESSION['_config']['ST']."',
- `C`='".$_SESSION['_config']['C']."',
+ `C`='".strtoupper($_SESSION['_config']['C'])."',
`comments`='".$_SESSION['_config']['comments']."'
where `id`='".intval($_SESSION['_config']['orgid'])."'");
showheader(_("My CAcert.org Account!"));
diff --git a/includes/notary.inc.php b/includes/notary.inc.php
index bff684b..bab10c9 100644
--- a/includes/notary.inc.php
+++ b/includes/notary.inc.php
@@ -1402,6 +1402,123 @@ function get_user_agreements($memid, $type=null, $active=null){
return (strtotime($date)<=time()+$diff*86400);
}
+ // table layout for organisation
+ /**
+ * org_edit_org_table()
+ *
+ * @param mixed $orgname
+ * @param mixed $contactmail
+ * @param mixed $town
+ * @param mixed $state
+ * @param mixed $country
+ * @param mixed $comment
+ * @param integer $type 0 - new, 1, edit
+ * @return
+ */
+ function org_edit_org_table($orgname, $contactmail, $town, $state, $country, $comment, $type=0){
+ if ($type > 0) {
+ $title = _('Edit Organisation');
+ $action = _('Update');
+ } else {
+ $title = _('New Organisation');
+ $action = _('Next');
+ }
+ org_edit_org_table_header($title);
+ org_edit_org_table_row(_('Organisation Name'), 'O', $orgname, 64);
+ org_edit_org_table_row(_('Contact Email'), 'contact', $contactmail, 255);
+ org_edit_org_table_row(_('Town/Suburb'), 'L', $town, 128);
+ org_edit_org_table_row(_('State/Province'), 'ST', $state, 128);
+ org_edit_org_table_country(_('Country'), 'C', $country, 2);
+ org_edit_org_table_comment(_('Comments'), 'comments', $comment);
+ org_edit_org_table_footer($action);
+ }
+
+ /**
+ * org_edit_org_table_header()
+ *
+ * @param mixed $title
+ * @return
+ */
+ function org_edit_org_table_header($title){
+ ?>
+ <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
+ <tr>
+ <td colspan="3" class="title"><?=$title?></td>
+ </tr>
+ <?
+ }
+
+ /**
+ * org_edit_org_table_row()
+ *
+ * @param mixed $label
+ * @param mixed $name
+ * @param mixed $value
+ * @param mixed $length
+ * @return
+ */
+ function org_edit_org_table_row($label, $name, $value, $length){
+ ?>
+ <tr>
+ <td class="DataTD"><?=$label?>:</td>
+ <td class="DataTD"><input type="text" name="<?=$name?>" value="<?=$value?>" maxlength="<?=$length?>" size="90"></td>
+ <td class="DataTD"><? printf(_('max %s characters'),$length)?></td>
+ </tr>
+ <?
+ }
+
+ /**
+ * org_edit_org_table_country()
+ *
+ * @param mixed $label
+ * @param mixed $name
+ * @param mixed $value
+ * @param mixed $length
+ * @return
+ */
+ function org_edit_org_table_country($label, $name, $value, $length){
+ ?>
+ <tr>
+ <td class="DataTD"><?=$label?>:</td>
+ <td class="DataTD"><input type="text" name="<?=$name?>" value="<?=$value?>" maxlength="<?=$length?>" size="<?=$length?>">
+ <? printf(_('(2 letter %s ISO code %s )'), '<a href="http://www.iso.org/iso/home/standards/country_codes/iso-3166-1_decoding_table.htm">', '</a>')?>
+ </td>
+ <td class="DataTD"><?=sprintf(_('max %s characters'),$length)?></td>
+ </tr>
+ <?
+ }
+
+ /**
+ * org_edit_org_table_comment()
+ *
+ * @param mixed $label
+ * @param mixed $name
+ * @param mixed $value
+ * @return
+ */
+ function org_edit_org_table_comment($label, $name, $value){
+ ?>
+ <tr>
+ <td class="DataTD"><?=$label?>:</td>
+ <td class="DataTD"><textarea name="<?=$name?>" cols=60 rows=10><?=$value?></textarea></td>
+ <td class="DataTD">&nbsp</td>
+ </tr>
+ <?
+ }
+ /**
+ * org_edit_org_table_footer()
+ *
+ * @param mixed $label
+ * @return
+ */
+ function org_edit_org_table_footer($label){
+ ?>
+ <tr>
+ <td class="DataTD" colspan="3"><input type="submit" name="process" value="<?=$label?>"></td>
+ </tr>
+ </table>
+ <?
+ }
/**
* get_array_from_ini()
diff --git a/pages/account/24.php b/pages/account/24.php
index 14a47c0..2ad526e 100644
--- a/pages/account/24.php
+++ b/pages/account/24.php
@@ -16,51 +16,25 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ ?>
<?
- // Reset session variables regarding Org's, present empty form
- if (array_key_exists('O',$_SESSION['_config'])) $_SESSION['_config']['O'] = "";
- if (array_key_exists('contact',$_SESSION['_config'])) $_SESSION['_config']['contact'] = "";
- if (array_key_exists('L',$_SESSION['_config'])) $_SESSION['_config']['L'] = "";
- if (array_key_exists('ST',$_SESSION['_config'])) $_SESSION['_config']['ST'] = "";
- if (array_key_exists('C',$_SESSION['_config'])) $_SESSION['_config']['C'] = "";
- if (array_key_exists('comments',$_SESSION['_config'])) $_SESSION['_config']['comments'] = "";
-
+$orgname = '';
+$contactmail = '';
+$town = '';
+$state = '';
+$country = '';
+$comment = '';
+
+ // Reset session variables regarding Org's, present empty form
+if (array_key_exists('O',$_SESSION['_config'])) $_SESSION['_config']['O'] = "";
+if (array_key_exists('contact',$_SESSION['_config'])) $_SESSION['_config']['contact'] = "";
+if (array_key_exists('L',$_SESSION['_config'])) $_SESSION['_config']['L'] = "";
+if (array_key_exists('ST',$_SESSION['_config'])) $_SESSION['_config']['ST'] = "";
+if (array_key_exists('C',$_SESSION['_config'])) $_SESSION['_config']['C'] = "";
+if (array_key_exists('comments',$_SESSION['_config'])) $_SESSION['_config']['comments'] = "";
+
?>
<form method="post" action="account.php">
-<table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
- <tr>
- <td colspan="2" class="title"><?=_("New Organisation")?></td>
- </tr>
- <tr>
- <td class="DataTD"><?=_("Organisation Name")?>:</td>
- <td class="DataTD"><input type="text" name="O" value="" maxlength="50" size="90"></td>
- </tr>
- <tr>
- <td class="DataTD"><?=_("Contact Email")?>:</td>
- <td class="DataTD"><input type="text" name="contact" value="" size="90"></td>
- </tr>
- <tr>
- <td class="DataTD"><?=_("Town/Suburb")?>:</td>
- <td class="DataTD"><input type="text" name="L" value="" size="90"></td>
- </tr>
- <tr>
- <td class="DataTD"><?=_("State/Province")?>:</td>
- <td class="DataTD"><input type="text" name="ST" value="" size="90"></td>
- </tr>
- <tr>
- <td class="DataTD"><?=_("Country")?>:</td>
- <td class="DataTD"><input type="text" name="C" value="" size="5">
- <?php printf(_('(2 letter %s ISO code %s )'),
- '<a href="http://www.iso.org/iso/home/standards/country_codes/iso-3166-1_decoding_table.htm">',
- '</a>')?>
- </td>
- </tr>
- <tr>
- <td class="DataTD"><?=_("Comments")?>:</td>
- <td class="DataTD"><textarea name="comments" cols="60" rows="10"></textarea></td>
- </tr>
- <tr>
- <td class="DataTD" colspan="2"><input type="submit" name="process" value="<?=_("Next")?>"></td>
- </tr>
-</table>
+<?
+org_edit_org_table($orgname, $contactmail, $town, $state, $country, $comment, 0);
+?>
<input type="hidden" name="oldid" value="<?=$id?>">
</form>
diff --git a/pages/account/27.php b/pages/account/27.php
index a1086d4..d07a781 100644
--- a/pages/account/27.php
+++ b/pages/account/27.php
@@ -16,46 +16,20 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ ?>
<?
- $row = mysql_fetch_assoc(mysql_query("select * from `orginfo` where `id`='".intval($_REQUEST['orgid'])."'"));
+ $orgid = intval($_REQUEST['orgid']);
+ $row = mysql_fetch_assoc(mysql_query("select * from `orginfo` where `id`='" . $orgid . "'"));
+ $orgname = $row['O'];
+ $contactmail = $row['contact'];
+ $town = $row['L'];
+ $state = $row['ST'];
+ $country = $row['C'];
+ $comment = $row['comments'];
?>
<form method="post" action="account.php">
-<table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
- <tr>
- <td colspan="2" class="title"><?=_("Edit Organisation")?></td>
- </tr>
- <tr>
- <td class="DataTD"><?=_("Organisation Name")?>:</td>
- <td class="DataTD"><input type="text" name="O" value="<?=$row['O']?>" size="90"></td>
- </tr>
- <tr>
- <td class="DataTD"><?=_("Contact Email")?>:</td>
- <td class="DataTD"><input type="text" name="contact" value="<?=($row['contact'])?>" size="90"></td>
- </tr>
- <tr>
- <td class="DataTD"><?=_("Town/Suburb")?>:</td>
- <td class="DataTD"><input type="text" name="L" value="<?=($row['L'])?>" size="90"></td>
- </tr>
- <tr>
- <td class="DataTD"><?=_("State/Province")?>:</td>
- <td class="DataTD"><input type="text" name="ST" value="<?=($row['ST'])?>" size="90"></td>
- </tr>
- <tr>
- <td class="DataTD"><?=_("Country")?>:</td>
- <td class="DataTD"><input type="text" name="C" value="<?=($row['C'])?>" size="5">
- <?php printf(_('(2 letter %s ISO code %s )'),
- '<a href="http://www.iso.org/iso/home/standards/country_codes/iso-3166-1_decoding_table.htm">',
- '</a>')?>
- </td>
- </tr>
- <tr>
- <td class="DataTD"><?=_("Comments")?>:</td>
- <td class="DataTD"><textarea name="comments" cols=60 rows=10><?=($row['comments'])?></textarea></td>
- </tr>
- <tr>
- <td class="DataTD" colspan="2"><input type="submit" name="process" value="<?=_("Update")?>"></td>
- </tr>
-</table>
+<?
+ org_edit_org_table($orgname, $contactmail, $town, $state, $country, $comment, 1);
+?>
<input type="hidden" name="oldid" value="<?=intval($id)?>">
-<input type="hidden" name="orgid" value="<?=intval($_REQUEST['orgid'])?>">
+<input type="hidden" name="orgid" value="<?=$orgid?>">
<input type="hidden" name="csrf" value="<?=make_csrf('orgdetchange')?>" />
</form>