bug 964: Unbreak lines and do some proper indentation and spacing
authorBenny Baumann <BenBE@geshi.org>
Tue, 19 Feb 2013 17:24:34 +0000 (18:24 +0100)
committerBenny Baumann <BenBE@geshi.org>
Tue, 19 Feb 2013 18:26:58 +0000 (19:26 +0100)
includes/keygen.php
www/keygenIE.js

index 866c5f2..da80aa0 100644 (file)
     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
 
-if (array_key_exists('HTTP_USER_AGENT',$_SERVER) &&
-               strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) { ?>
+if (array_key_exists('HTTP_USER_AGENT',$_SERVER) && strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) { ?>
 
        <noscript>
-               <p><?=_('You have to enable JavaScript to generate certificates in '.
-                               'the browser.')?></p>
+               <p><?=_('You have to enable JavaScript to generate certificates in the browser.')?></p>
                <p><?=_('If you don\'t want to do that for any reason, you can use '.
-                               'manually created certificate requests instead.')?></p>
+                       'manually created certificate requests instead.')?></p>
        </noscript>
 
        <div id="noActiveX" style="color:red">
-               <p><?=_('Could not initialize ActiveX object required for certificate '.
-                               'generation.')?></p>
-               <p><?=_('You have to enable ActiveX for this to work. On Windows '.
-                               'Vista, Windows 7 and later versions you have to add this '.
-                               'website to the list of trusted sites in the internet '.
-                               'settings.')?></p>
+               <p><?=_('Could not initialize ActiveX object required for certificate generation.')?></p>
+               <p><?=_('You have to enable ActiveX for this to work. On Windows Vista, Windows 7 and '.
+                       'later versions you have to add this website to the list of trusted sites '.
+                       'in the internet settings.')?></p>
                <p><?php
                        printf(_('Go to "Extras -> Internet Options -> Security -> Trusted '.
                                'Websites", click on "Custom Level", set "ActiveX control '.
@@ -78,13 +74,12 @@ if (array_key_exists('HTTP_USER_AGENT',$_SERVER) &&
                                echo _('Step')?>: <span id="keySizeStep"></span></p>
                        <p style="color:red"><?php
                                printf(_('Please note that RSA key sizes smaller than %d bit '.
-                                               'will not be accepted by CAcert.'),
-                                               1024)?>
+                                       'will not be accepted by CAcert.'),
+                                       1024)?>
                        </p>
                </fieldset>
 
-               <p><input type="submit" id="GenReq" name="GenReq"
-                               value="<?=_('Create Certificate')?>" /></p>
+               <p><input type="submit" id="GenReq" name="GenReq" value="<?=_('Create Certificate')?>" /></p>
                <p id="generatingKeyNotice" style="display:none">
                        <?=_('Generating your key. Please wait')?>&hellip;</p>
        </form>
@@ -93,15 +88,15 @@ if (array_key_exists('HTTP_USER_AGENT',$_SERVER) &&
        translated without passing the JavaScript code through PHP -->
        <p id="createRequestErrorChooseAlgorithm" style="display:none">
                <?=_('Could not generate certificate request. Probably you need to '.
-                               'choose a different algorithm.')?>
+                       'choose a different algorithm.')?>
        </p>
        <p id="createRequestErrorConfirmDialogue" style="display:none">
                <?=_('Could not generate certificate request. Please confirm the '.
-                               'dialogue if you are asked if you want to generate the key.')?>
+                       'dialogue if you are asked if you want to generate the key.')?>
        </p>
        <p id="createRequestErrorConnectDevice" style="display:none">
                <?=_('Could not generate certificate request. Please make sure the '.
-                               'cryptography device (e.g. the smartcard) is connected.')?>
+                       'cryptography device (e.g. the smartcard) is connected.')?>
        </p>
        <p id="createRequestError" style="display:none">
                <?=_('Could not generate certificate request.')?>
@@ -111,23 +106,23 @@ if (array_key_exists('HTTP_USER_AGENT',$_SERVER) &&
        </p>
        <p id="unsupportedPlatformError" style="display:none">
                <?=_('Could not initialize the cryptographic module for your '.
-                               'platform. Currently we support Microsoft Windows XP, Vista '.
-                               'and 7. If you\'re using one of these platforms and see this '.
-                               'error message anyway you might have to enable ActiveX as '.
-                               'described in the red explanation text and accept loading of '.
-                               'the module.')?>
+                       'platform. Currently we support Microsoft Windows XP, Vista '.
+                       'and 7. If you\'re using one of these platforms and see this '.
+                       'error message anyway you might have to enable ActiveX as '.
+                       'described in the red explanation text and accept loading of '.
+                       'the module.')?>
        </p>
 
        <script type="text/javascript" src="keygenIE.js"></script>
 
 <? } else { ?>
-    <p>
-    <form method="post" action="account.php">
-        <input type="hidden" name="keytype" value="NS">
-        <?=_("Keysize:")?> <keygen name="SPKAC" challenge="<? $_SESSION['spkac_hash']=make_hash(); echo $_SESSION['spkac_hash']; ?>">
+       <p>
+               <form method="post" action="account.php">
+                       <input type="hidden" name="keytype" value="NS">
+                       <?=_("Keysize:")?> <keygen name="SPKAC" challenge="<? $_SESSION['spkac_hash']=make_hash(); echo $_SESSION['spkac_hash']; ?>">
 
-        <input type="submit" name="submit" value="<?=_("Create Certificate Request")?>">
-        <input type="hidden" name="oldid" value="<?=$id?>">
-    </form>
-    </p>
+                       <input type="submit" name="submit" value="<?=_("Create Certificate Request")?>">
+                       <input type="hidden" name="oldid" value="<?=$id?>">
+               </form>
+       </p>
 <? }
index 2c2018e..3a63f9b 100644 (file)
@@ -54,10 +54,12 @@ var CAcert_keygen_IE = function () {
 
        /// Show error message to user from exception
        var showError = function (message, exception) {
-               window.alert(message +
-                               "\n\nError: " + exception.message +
-                               " (0x" + (0xFFFFFFFF + exception.number +1).toString(16) +
-                               " / " + exception.number + ")");
+               window.alert(
+                       message +
+                       "\n\nError: " + exception.message +
+                       " (0x" + (0xFFFFFFFF + exception.number + 1).toString(16) +
+                       " / " + exception.number + ")"
+                       );
        }
 
        // Get important elements from the DOM
@@ -91,13 +93,12 @@ var CAcert_keygen_IE = function () {
 
                // Try to initialise the ActiveX element. Requires permissions by the user
                try {
-                       factory = new ActiveXObject(
-                               "X509Enrollment.CX509EnrollmentWebClassFactory");
+                       factory = new ActiveXObject("X509Enrollment.CX509EnrollmentWebClassFactory");
                        if (!factory) {
                                throw {
                                        name: "NoObjectError",
                                        message: "Got null at object creation"
-                               };
+                                       };
                        }
 
                        // also try to create a useless object here so the library gets
@@ -172,11 +173,11 @@ var CAcert_keygen_IE = function () {
                        var csp = getProvider();
 
                        cspStats = providerList.GetCspStatusesFromOperations(
-                                       0x1c, //XCN_NCRYPT_ANY_ASYMMETRIC_OPERATION
-                                       //0x10, //XCN_NCRYPT_SIGNATURE_OPERATION
-                                       //0x8, //XCN_NCRYPT_SECRET_AGREEMENT_OPERATION
-                                       //0x4, //XCN_NCRYPT_ASYMMETRIC_ENCRYPTION_OPERATION
-                                       csp
+                               0x1c, //XCN_NCRYPT_ANY_ASYMMETRIC_OPERATION
+                               //0x10, //XCN_NCRYPT_SIGNATURE_OPERATION
+                               //0x8, //XCN_NCRYPT_SECRET_AGREEMENT_OPERATION
+                               //0x4, //XCN_NCRYPT_ASYMMETRIC_ENCRYPTION_OPERATION
+                               csp
                                );
 
                        removeChildren(algorithm);
@@ -228,8 +229,8 @@ var CAcert_keygen_IE = function () {
 
                                algorithmOid = factory.CreateObject("X509Enrollment.CObjectId");
                                algorithmOid.InitializeFromValue("1.2.840.113549.1.1.1"); // RSA
-                               //"1.2.840.10040.4.1" == DSA
-                               //"1.2.840.10046.2.1" == DH
+                               // "1.2.840.10040.4.1" == DSA
+                               // "1.2.840.10046.2.1" == DH
 
                                if (level.value === "high") {
                                        bits = 4096;
@@ -244,12 +245,11 @@ var CAcert_keygen_IE = function () {
                        privateKey.Length = bits;
                        privateKey.KeyUsage = 0xffffff; // XCN_NCRYPT_ALLOW_ALL_USAGES
 
-                       var request = factory.CreateObject(
-                               "X509Enrollment.CX509CertificateRequestPkcs10");
+                       var request = factory.CreateObject("X509Enrollment.CX509CertificateRequestPkcs10");
                        request.InitializeFromPrivateKey(
-                                       1, // ContextUser
-                                       privateKey,
-                                       "" // don't use a template
+                               1, // ContextUser
+                               privateKey,
+                               "" // don't use a template
                                );
 
                        var enroll = factory.CreateObject("X509Enrollment.CX509Enrollment");
@@ -266,7 +266,7 @@ var CAcert_keygen_IE = function () {
                                } catch (e) {
                                        showError(createRequestErrorChooseAlgorithm.innerHTML, e);
                                }
-                               
+
                                generatingKeyNotice.style.display = "none";
                        }
 
@@ -322,11 +322,11 @@ var CAcert_keygen_IE = function () {
                        );
 
                algClasses = Array(
-                               1 << 13, //ALG_CLASS_SIGNATURE
-                               //2 << 13, //ALG_CLASS_MSG_ENCRYPT
-                               //3 << 13, //ALG_CLASS_DATA_ENCRYPT
-                               //4 << 13, //ALG_CLASS_HASH
-                               5 << 13  //ALG_CLASS_KEY_EXCHANGE
+                       1 << 13, //ALG_CLASS_SIGNATURE
+                       //2 << 13, //ALG_CLASS_MSG_ENCRYPT
+                       //3 << 13, //ALG_CLASS_DATA_ENCRYPT
+                       //4 << 13, //ALG_CLASS_HASH
+                       5 << 13  //ALG_CLASS_KEY_EXCHANGE
                        );
 
                // Try to initialise the ActiveX element.
@@ -364,8 +364,7 @@ var CAcert_keygen_IE = function () {
 
                /// Get the ID of the selected algorithm
                var getAlgorithmId = function () {
-                       return parseInt(
-                                       algorithm.options[algorithm.selectedIndex].value, 10);
+                       return parseInt(algorithm.options[algorithm.selectedIndex].value, 10);
                }
 
                /// Minimum bit length for exchange keys
@@ -507,8 +506,7 @@ var CAcert_keygen_IE = function () {
                                for (j = 0; true; ++j) {
                                        try {
                                                providerName = cenroll.enumProviders(j, 0);
-                                               provider.appendChild(
-                                                               option(providerName, providerTypes[i]));
+                                               provider.appendChild(option(providerName, providerTypes[i]));
                                        } catch (e) {
                                                break;
                                        }