diff options
author | INOPIAE <inopiae@cacert.org> | 2013-05-14 22:59:46 +0200 |
---|---|---|
committer | INOPIAE <inopiae@cacert.org> | 2013-05-14 22:59:46 +0200 |
commit | 71d6d063bc6633d67133ccb53f67d5d27f9f5b99 (patch) | |
tree | 9c4a6ce385504664dbbb3025c51a2e086feabfdd | |
parent | 45ee203868aa194b242293102d96d5ef71f4a37c (diff) | |
download | cacert-devel-71d6d063bc6633d67133ccb53f67d5d27f9f5b99.tar.gz cacert-devel-71d6d063bc6633d67133ccb53f67d5d27f9f5b99.tar.xz cacert-devel-71d6d063bc6633d67133ccb53f67d5d27f9f5b99.zip |
bug 782: Added comment update for all certificate view pages
-rw-r--r-- | includes/account.php | 60 | ||||
-rw-r--r-- | pages/account/12.php | 23 | ||||
-rw-r--r-- | pages/account/18.php | 13 | ||||
-rw-r--r-- | pages/account/22.php | 20 | ||||
-rw-r--r-- | pages/account/5.php | 2 | ||||
-rw-r--r-- | pages/gpg/2.php | 19 | ||||
-rw-r--r-- | www/gpg.php | 43 |
7 files changed, 144 insertions, 36 deletions
diff --git a/includes/account.php b/includes/account.php index df5fadd..a53cdc7 100644 --- a/includes/account.php +++ b/includes/account.php @@ -997,6 +997,26 @@ exit; } + if($oldid == 12 && array_key_exists('change',$_REQUEST) && $_REQUEST['change'] != "") + { + showheader(_("My CAcert.org Account!")); + foreach($_REQUEST as $id => $val) + { + if(substr($id,0,14)=="check_comment_") + { + $cid = intval(substr($id,14)); + if(!empty($_REQUEST['check_comment_'.$cid])) { + $comment=trim(mysql_real_escape_string(stripslashes($_REQUEST['comment_'.$cid]))); + mysql_query("update `domaincerts` set `description`='$comment' where `id`='$cid' and `memid`='".$_SESSION['profile']['id']."'"); + } + } + } + echo(_("Certificate settings have been changed.")."<br/>\n"); + showfooter(); + exit; + } + + if($oldid == 5 && array_key_exists('renew',$_REQUEST) && $_REQUEST['renew'] != "") { showheader(_("My CAcert.org Account!")); @@ -1775,6 +1795,26 @@ exit; } + if($oldid == 18 && array_key_exists('change',$_REQUEST) && $_REQUEST['change'] != "") + { + showheader(_("My CAcert.org Account!")); + foreach($_REQUEST as $id => $val) + { + if(substr($id,0,14)=="check_comment_") + { + $cid = intval(substr($id,14)); + if(!empty($_REQUEST['check_comment_'.$cid])) { + $comment=trim(mysql_real_escape_string(stripslashes($_REQUEST['comment_'.$cid]))); + mysql_query("update `orgemailcerts` set `description`='$comment' where `id`='$cid' and `memid`='".$_SESSION['profile']['id']."'"); + } + } + } + echo(_("Certificate settings have been changed.")."<br/>\n"); + showfooter(); + exit; + } + + if($process != "" && $oldid == 20) { $CSR = clean_csr($_REQUEST['CSR']); @@ -2112,6 +2152,26 @@ exit; } + if($oldid == 22 && array_key_exists('change',$_REQUEST) && $_REQUEST['change'] != "") + { + showheader(_("My CAcert.org Account!")); + foreach($_REQUEST as $id => $val) + { + if(substr($id,0,14)=="check_comment_") + { + $cid = intval(substr($id,14)); + if(!empty($_REQUEST['check_comment_'.$cid])) { + $comment=trim(mysql_real_escape_string(stripslashes($_REQUEST['comment_'.$cid]))); + mysql_query("update `orgdomaincerts` set `description`='$comment' where `id`='$cid' and `memid`='".$_SESSION['profile']['id']."'"); + } + } + } + echo(_("Certificate settings have been changed.")."<br/>\n"); + showfooter(); + exit; + } + + if(($id == 24 || $oldid == 24 || $id == 25 || $oldid == 25 || $id == 26 || $oldid == 26 || $id == 27 || $oldid == 27 || $id == 28 || $oldid == 28 || $id == 29 || $oldid == 29 || $id == 30 || $oldid == 30 || $id == 31 || $oldid == 31) && diff --git a/pages/account/12.php b/pages/account/12.php index 35ae6c2..44c5739 100644 --- a/pages/account/12.php +++ b/pages/account/12.php @@ -19,16 +19,16 @@ <form method="post" action="account.php"> <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper"> <tr> - <td colspan="6" class="title"><?=_("Domain Certificates")?> - <a href="account.php?id=12&viewall=<?=!$viewall?>"><?=_("View all certificates")?></a></td> + <td colspan="8" class="title"><?=_("Domain Certificates")?> - <a href="account.php?id=12&viewall=<?=!$viewall?>"><?=_("View all certificates")?></a></td> </tr> <tr> <td class="DataTD"><?=_("Renew/Revoke/Delete")?></td> <td class="DataTD"><?=_("Status")?></td> <td class="DataTD"><?=_("CommonName")?></td> - <td class="DataTD"><?=_("SerialNumber")?></td> - <td class="DataTD"><?=_("Comment")?></td> + <td class="DataTD"><?=_("SerialNumber")?></td> <td class="DataTD"><?=_("Revoked")?></td> <td class="DataTD"><?=_("Expires")?></td> + <td colspan="2" class="DataTD"><?=_("Comment *")?></td> </tr> <? $query = "select UNIX_TIMESTAMP(`domaincerts`.`created`) as `created`, @@ -51,7 +51,7 @@ { ?> <tr> - <td colspan="6" class="DataTD"><?=_("No domains are currently listed.")?></td> + <td colspan="8" class="DataTD"><?=_("No domains are currently listed.")?></td> </tr> <? } else { while($row = mysql_fetch_assoc($res)) @@ -64,8 +64,8 @@ $verified = _("Pending"); if($row['revoked'] > 0) $verified = _("Revoked"); - if($row['revoked'] == 0) - $row['revoke'] = _("Not Revoked"); + if($row['revoked'] == 0) + $row['revoke'] = _("Not Revoked"); ?> <tr> <? if($verified != _("Pending") && $verified != _("Revoked")) { ?> @@ -77,15 +77,22 @@ <? } ?> <td class="DataTD"><?=$verified?></td> <td class="DataTD"><a href="account.php?id=15&cert=<?=$row['id']?>"><?=$row['CN']?></a></td> - <td class="DataTD"><?=$row['serial']?></td> - <td class="DataTD"><?=$row['description']?></td> + <td class="DataTD"><?=$row['serial']?></td> <td class="DataTD"><?=$row['revoke']?></td> <td class="DataTD"><?=$row['expires']?></td> + <td class="DataTD"><input name="comment_<?=$row['id']?>" type="text" value="<?=htmlspecialchars($row['description'])?>" /></td> + <td class="DataTD"><input type="checkbox" name="check_comment_<?=$row['id']?>" /></td> </tr> <? } ?> <tr> + <td class="DataTD" colspan="8"> + <?=_("* Comment is NOT included in the certificate as it is inteded for your personal reference only. To change the comment go to the certificate view with hitting email address.")?> + </td> + </tr> + <tr> <td class="DataTD" colspan="6"><input type="submit" name="renew" value="<?=_("Renew")?>">     <input type="submit" name="revoke" value="<?=_("Revoke/Delete")?>"></td> + <td class="DataTD" colspan="2"><input type="submit" name="change" value="<?=_("Change settings")?>"> </td> </tr> <? } ?> </table> diff --git a/pages/account/18.php b/pages/account/18.php index 45e3be9..e736977 100644 --- a/pages/account/18.php +++ b/pages/account/18.php @@ -19,7 +19,7 @@ <form method="post" action="account.php"> <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper"> <tr> - <td colspan="6" class="title"><?=_("Client Certificates")?> - <a href="account.php?id=18&viewall=<?=!$viewall?>"><?=_("View all certificates")?></a></td> + <td colspan="8" class="title"><?=_("Client Certificates")?> - <a href="account.php?id=18&viewall=<?=!$viewall?>"><?=_("View all certificates")?></a></td> </tr> <tr> <td class="DataTD"><?=_("Renew/Revoke/Delete")?></td> @@ -52,7 +52,7 @@ { ?> <tr> - <td colspan="6" class="DataTD"><?=_("No client certificates are currently listed.")?></td> + <td colspan="8" class="DataTD"><?=_("No client certificates are currently listed.")?></td> </tr> <? } else { while($row = mysql_fetch_assoc($res)) @@ -83,14 +83,21 @@ <td class="DataTD"><a href="account.php?id=19&cert=<?=$row['id']?>"><?=$row['CN']?></a></td> <? } ?> <td class="DataTD"><?=$row['serial']?></td> - <td class="DataTD"><?=$row['description']?></td> <td class="DataTD"><?=$row['revoke']?></td> <td class="DataTD"><?=$row['expires']?></td> + <td class="DataTD"><input name="comment_<?=$row['id']?>" type="text" value="<?=htmlspecialchars($row['description'])?>" /></td> + <td class="DataTD"><input type="checkbox" name="check_comment_<?=$row['id']?>" /></td> </tr> <? } ?> <tr> + <td class="DataTD" colspan="8"> + <?=_("* Comment is NOT included in the certificate as it is inteded for your personal reference only. To change the comment go to the certificate view with hitting email address.")?> + </td> + </tr> + <tr> <td class="DataTD" colspan="6"><input type="submit" name="renew" value="<?=_("Renew")?>">     <input type="submit" name="revoke" value="<?=_("Revoke/Delete")?>"></td> + <td class="DataTD" colspan="2"><input type="submit" name="change" value="<?=_("Change settings")?>"> </td> </tr> <? } ?> </table> diff --git a/pages/account/22.php b/pages/account/22.php index ac7a645..5d53582 100644 --- a/pages/account/22.php +++ b/pages/account/22.php @@ -19,17 +19,16 @@ <form method="post" action="account.php"> <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper"> <tr> - <td colspan="6" class="title"><?=_("Domain Certificates")?> - <a href="account.php?id=22&viewall=<?=!$viewall?>"><?=_("View all certificates")?></a></td> + <td colspan="8" class="title"><?=_("Domain Certificates")?> - <a href="account.php?id=22&viewall=<?=!$viewall?>"><?=_("View all certificates")?></a></td> </tr> <tr> <td class="DataTD"><?=_("Renew/Revoke/Delete")?></td> <td class="DataTD"><?=_("Status")?></td> <td class="DataTD"><?=_("CommonName")?></td> - <td class="DataTD"><?=_("SerialNumber")?></td> - <td class="DataTD"><?=_("Comment")?></td> + <td class="DataTD"><?=_("SerialNumber")?></td> <td class="DataTD"><?=_("Revoked")?></td> <td class="DataTD"><?=_("Expires")?></td> - + <td colspan="2" class="DataTD"><?=_("Comment *")?></td> <? $query = "select UNIX_TIMESTAMP(`orgdomaincerts`.`created`) as `created`, UNIX_TIMESTAMP(`orgdomaincerts`.`expire`) - UNIX_TIMESTAMP() as `timeleft`, @@ -53,7 +52,7 @@ { ?> <tr> - <td colspan="6" class="DataTD"><?=_("No domains are currently listed.")?></td> + <td colspan="8" class="DataTD"><?=_("No domains are currently listed.")?></td> </tr> <? } else { while($row = mysql_fetch_assoc($res)) @@ -79,15 +78,22 @@ <? } ?> <td class="DataTD"><?=$verified?></td> <td class="DataTD"><a href="account.php?id=23&cert=<?=$row['id']?>"><?=$row['CN']?></a></td> - <td class="DataTD"><?=$row['serial']?></td> - <td class="DataTD"><?=$row['description']?></td> + <td class="DataTD"><?=$row['serial']?></td> <td class="DataTD"><?=$row['revoke']?></td> <td class="DataTD"><?=$row['expires']?></td> + <td class="DataTD"><input name="comment_<?=$row['id']?>" type="text" value="<?=htmlspecialchars($row['description'])?>" /></td> + <td class="DataTD"><input type="checkbox" name="check_comment_<?=$row['id']?>" /></td> </tr> <? } ?> <tr> + <td class="DataTD" colspan="8"> + <?=_("* Comment is NOT included in the certificate as it is inteded for your personal reference only. To change the comment go to the certificate view with hitting email address.")?> + </td> + </tr> + <tr> <td class="DataTD" colspan="6"><input type="submit" name="renew" value="<?=_("Renew")?>">     <input type="submit" name="revoke" value="<?=_("Revoke/Delete")?>"></td> + <td class="DataTD" colspan="2"><input type="submit" name="change" value="<?=_("Change settings")?>"> </td> </tr> <? } ?> </table> diff --git a/pages/account/5.php b/pages/account/5.php index 133e0fe..515d33f 100644 --- a/pages/account/5.php +++ b/pages/account/5.php @@ -57,7 +57,7 @@ { ?> <tr> - <td colspan="8" class="DataTD"><?=_("No client certificates are currently listed.")?></td> + <td colspan="10" class="DataTD"><?=_("No client certificates are currently listed.")?></td> </tr> <? } else { while($row = mysql_fetch_assoc($res)) diff --git a/pages/gpg/2.php b/pages/gpg/2.php index fd26367..1773dfa 100644 --- a/pages/gpg/2.php +++ b/pages/gpg/2.php @@ -17,19 +17,19 @@ */ ?> <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper"> <tr> - <td colspan="5" class="title"><?=_("OpenPGP Keys")?></td> + <td colspan="6" class="title"><?=_("OpenPGP Keys")?></td> </tr> <tr> <td class="DataTD"><?=_("Status")?></td> <td class="DataTD"><?=_("Email Address")?></td> <td class="DataTD"><?=_("Expires")?></td> <td class="DataTD"><?=_("Key ID")?></td> - <td class="DataTD"><?=_("Comment")?></td> + <td colspan="2" class="DataTD"><?=_("Comment *")?></td> <? $query = "select UNIX_TIMESTAMP(`issued`) as `issued`, UNIX_TIMESTAMP(`expire`) - UNIX_TIMESTAMP() as `timeleft`, UNIX_TIMESTAMP(`expire`) as `expired`, - `expire` as `expires`, `id`, `level`, + `expire` as `expires`, `id`, `level`, `email`,`keyid`,`description` from `gpg` where `memid`='".intval($_SESSION['profile']['id'])."' ORDER BY `issued` desc"; $res = mysql_query($query); @@ -37,7 +37,7 @@ { ?> <tr> - <td colspan="5" class="DataTD"><?=_("No OpenPGP keys are currently listed.")?></td> + <td colspan="6" class="DataTD"><?=_("No OpenPGP keys are currently listed.")?></td> </tr> <? } else { while($row = mysql_fetch_assoc($res)) @@ -62,10 +62,19 @@ <? } ?> <td class="DataTD"><?=$row['expires']?></td> <td class="DataTD"><a href="gpg.php?id=3&cert=<?=$row['id']?>"><?=$row['keyid']?></a></td> - <td class="DataTD"><?=$row['description']?></td> + <td class="DataTD"><input name="comment_<?=$row['id']?>" type="text" value="<?=htmlspecialchars($row['description'])?>" /></td> + <td class="DataTD"><input type="checkbox" name="check_comment_<?=$row['id']?>" /></td> </tr> <? } ?> <? } ?> + <tr> + <td class="DataTD" colspan="6"> + <?=_("* Comment is NOT included in the certificate as it is inteded for your personal reference only. To change the comment go to the certificate view with hitting email address.")?> + </td> + </tr> + <tr> + <td class="DataTD" colspan="6"><input type="submit" name="change" value="<?=_("Change settings")?>"> </td> + </tr> </table> <input type="hidden" name="oldid" value="<?=$id?>"> </form> diff --git a/www/gpg.php b/www/gpg.php index fcc0742..132e522 100644 --- a/www/gpg.php +++ b/www/gpg.php @@ -52,7 +52,7 @@ if(0) { showheader(_("Welcome to CAcert.org")); echo "The OpenPGP signing system is currently shutdown due to a maintenance. We hope to get it fixed within the next few hours. We are very sorry for the inconvenience."; - + exit(0); } } @@ -143,7 +143,7 @@ function verifyEmail($email) $uidformatwrong=0; if(sizeof($bits)<10) $uidformatwrong=1; - + if(preg_match("/\@.*\@/",$bits[9])) { showheader(_("Welcome to CAcert.org")); @@ -248,7 +248,7 @@ function verifyEmail($email) $resulttable.="</tr>\n"; if($emailok) $multiple++; - + if(trim($_REQUEST['description']) == ""){ $description= trim(mysql_real_escape_string(stripslashes($_REQUEST['description']))); }else{ @@ -286,7 +286,7 @@ function verifyEmail($email) `level`='1', `expires`='".mysql_real_escape_string($expires)."', `multiple`='".mysql_real_escape_string($multiple)."', - `keyid`='".mysql_real_escape_string($keyid)."', + `keyid`='".mysql_real_escape_string($keyid)."', `description`='".mysql_real_escape_string($description)."'"; mysql_query($query); $id = mysql_insert_id(); @@ -349,7 +349,7 @@ function verifyEmail($email) { //echo "Not found!\n"; } - + $emailok=verifyEmail($mail); $uidid=$bits[7]; @@ -403,14 +403,14 @@ function verifyEmail($email) 1 => array("pipe", "w"), // stdout is a pipe that the child will write to 2 => array("pipe", "w") // stderr is a file to write to ); - - $stderr = fopen('php://stderr', 'w'); + + $stderr = fopen('php://stderr', 'w'); //echo "Keyid: $keyid\n"; $process = proc_open("/usr/bin/gpg --homedir $cwd --no-tty --command-fd 0 --status-fd 1 --logger-fd 2 --edit-key $keyid", $descriptorspec, $pipes); - + //echo "Process: $process\n"; //fputs($stderr,"Process: $process\n"); @@ -420,7 +420,7 @@ function verifyEmail($email) // 0 => writeable handle connected to child stdin // 1 => readable handle connected to child stdout // Any error output will be appended to /tmp/error-output.txt - while (!feof($pipes[1])) + while (!feof($pipes[1])) { $buffer = fgets($pipes[1], 4096); //echo $buffer; @@ -472,14 +472,14 @@ function verifyEmail($email) } //echo "Fertig\n"; fclose($pipes[0]); - + //echo stream_get_contents($pipes[1]); fclose($pipes[1]); - + // It is important that you close any pipes before calling // proc_close in order to avoid a deadlock $return_value = proc_close($process); - + //echo "command returned $return_value\n"; } else @@ -515,6 +515,25 @@ function verifyEmail($email) exit; } +if($oldid == 2 && array_key_exists('change',$_REQUEST) && $_REQUEST['change'] != "") +{ + showheader(_("My CAcert.org Account!")); + foreach($_REQUEST as $id => $val) + { + if(substr($id,0,14)=="check_comment_") + { + $cid = intval(substr($id,14)); + if(!empty($_REQUEST['check_comment_'.$cid])) { + $comment=trim(mysql_real_escape_string(stripslashes($_REQUEST['comment_'.$cid]))); + mysql_query("update `gpg` set `description`='$comment' where `id`='$cid' and `memid`='".$_SESSION['profile']['id']."'"); + } + } + } + echo(_("Certificate settings have been changed.")."<br/>\n"); + showfooter(); + exit; +} + $id = intval($id); showheader(_("Welcome to CAcert.org")); |