[dev] [PATCH] PGP and S/MIME public key import setting

Sergei Turchanov sergei.turchanov at vvsu.ru
Tue May 3 18:50:15 PDT 2005


Hello,

with this patch S/MIME public certificate import looks the same
as PGP one. Also clearly indicate requirements for key import:
file upload support and address book to modify contacts (add_source).

With best regards,
Sergei Turchanov.

-------------- next part --------------
Index: horde2/imp/templates/pgp/pgp.inc
===================================================================
RCS file: /repository/imp/templates/pgp/pgp.inc,v
retrieving revision 1.36
diff -u -r1.36 pgp.inc
--- horde2/imp/templates/pgp/pgp.inc	15 Apr 2005 12:57:21 -0000	1.36
+++ horde2/imp/templates/pgp/pgp.inc	4 May 2005 01:43:15 -0000
@@ -36,14 +36,18 @@
 <?php endif; ?>
 </div>
 
-<?php if ($imp['file_upload']): ?>
 <br class="spacer" />
 <div class="nowrap">
+<?php if (!$imp['file_upload']): ?>
+  <font color="red"><?=_("Key import is not available. File upload is not enabled in your PHP configuration.")?></font>
+<?php elseif (!$GLOBALS['prefs']->getValue('add_source')): ?>
+  <strong><?=_("Key import is not available. You have no address book defined to add/modify your contacts.")?></strong>
+<?php else: ?>
   <?php $public_import_url = Util::addParameter(Util::addParameter($selfURL, 'actionID', 'import_public_key'), 'reload', $selfURL); ?>
   <input type="submit" name="save" class="button" onclick="open_pgp_import('<?php echo $public_import_url ?>'); return false;" value="<?php echo _("Import Public Key") ?>" />
   <?php echo Help::link('imp', 'pgp-import-pubkey') ?>
-</div>
 <?php endif; ?>
+</div>
 
 <br class="spacer" />
 <div class="header">
Index: horde2/imp/templates/smime/smime.inc
===================================================================
RCS file: /repository/imp/templates/smime/smime.inc,v
retrieving revision 1.33
diff -u -r1.33 smime.inc
--- horde2/imp/templates/smime/smime.inc	2 May 2005 20:44:24 -0000	1.33
+++ horde2/imp/templates/smime/smime.inc	4 May 2005 01:43:15 -0000
@@ -4,10 +4,6 @@
 
 <br class="spacer" />
 <div class="header">
-  <ul>
-<?php if ($imp['file_upload']): ?>
-    <li><?php echo Horde::link('#', _("Import Public Key"), '', '', 'open_smime_import(\'' . Util::addParameter($selfURL, array('actionID' => 'import_public_key', 'reload' => $selfURL)) . '\');return false;') . _("Import Public Key"); ?></a></li>
-<?php endif; ?>
     <li><?php echo Help::link('imp', 'smime-manage-pubkey') ?></li>
   </ul>
   <?php echo _("S/MIME Public Keyring") ?>
@@ -33,6 +29,18 @@
 </div>
 
 <br class="spacer" />
+<div class="nowrap">
+<?php if (!$imp['file_upload']): ?>
+  <font color="red"><?=_("Key import is not available. File upload is not enabled in your PHP configuration.")?></font>
+<?php elseif (!$GLOBALS['prefs']->getValue('add_source')): ?>
+  <strong><?=_("Key import is not available. You have no address book defined to add/modify your contacts.")?></strong>
+<?php else: ?>
+  <?php $public_import_url = Util::addParameter($selfURL, array('actionID' => 'import_public_key', 'reload' => $selfURL)); ?>
+  <input type="submit" name="save" class="button" onclick="open_smime_import('<?php echo $public_import_url ?>'); return false;" value="<?php echo _("Import Public Key") ?>" />
+<?php endif; ?>
+</div>
+
+<br class="spacer" />
 <div class="header">
   <ul>
 <?php if ($imp['file_upload'] && (!$prefs->getValue('smime_public_key') || !$prefs->getValue('smime_private_key'))): ?>


More information about the dev mailing list