Completed
Pull Request — master (#14)
by Janusz
10:08 queued 04:29
created
web/copyright.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -205,14 +205,14 @@
 block discarded – undo
205 205
                  </td>
206 206
                  <td style="padding-left:80px; padding-right:20px; text-align:right; vertical-align:top;">
207 207
                  <?php
208
-                     if (Config::$CONSORTIUM['name'] == "eduroam" && isset(Config::$CONSORTIUM['deployment-voodoo']) && Config::$CONSORTIUM['deployment-voodoo'] == "Operations Team") // SW: APPROVED
209
-                         echo "
208
+                        if (Config::$CONSORTIUM['name'] == "eduroam" && isset(Config::$CONSORTIUM['deployment-voodoo']) && Config::$CONSORTIUM['deployment-voodoo'] == "Operations Team") // SW: APPROVED
209
+                            echo "
210 210
                   <span id='logos' style='position:fixed; left:50%;'><img src='resources/images/dante.png' alt='DANTE' style='height:23px;width:47px'/>
211 211
                   <img src='resources/images/eu.png' alt='EU' style='height:23px;width:27px;border-width:0px;'/></span>
212 212
                   <span id='eu_text' style='text-align:right;'><a href='http://ec.europa.eu/dgs/connect/index_en.htm' style='text-decoration:none; vertical-align:top;'>European Commission Communications Networks, Content and Technology</a></span>";
213
-                     else
214
-                         echo "&nbsp;";
215
-                 ?>
213
+                        else
214
+                            echo "&nbsp;";
215
+                    ?>
216 216
                 </td>
217 217
             </tr>
218 218
         </table>
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
         <div id="heading">
24 24
             <?php
25 25
             print '<img src="resources/images/consortium_logo.png" alt="Consortium Logo" style="float:right; padding-right:20px; padding-top:20px"/>';
26
-            print '<div id="motd">'.( isset(Config::$APPEARANCE['MOTD']) ? Config::$APPEARANCE['MOTD'] : '&nbsp' ).'</div>';
26
+            print '<div id="motd">' . (isset(Config::$APPEARANCE['MOTD']) ? Config::$APPEARANCE['MOTD'] : '&nbsp') . '</div>';
27 27
             print '<h1 style="padding-bottom:0px; height:1em;">' . sprintf(_("%s Copyright and Licensing"), Config::$APPEARANCE['productname']) . '</h1>
28 28
 <h2 style="padding-bottom:0px; height:0px; vertical-align:bottom;">' . Config::$APPEARANCE['productname_long'] . '</h2>';
29 29
             echo '<table id="lang_select"><tr><td>';
Please login to merge, or discard this patch.
Braces   +10 added lines, -7 removed lines patch added patch discarded remove patch
@@ -196,22 +196,25 @@
 block discarded – undo
196 196
 // this variable gets set during "make distribution" only
197 197
                     $RELEASE = "THERELEASE";
198 198
                     echo Config::$APPEARANCE['productname'] . " - ";
199
-                    if ($RELEASE != "THERELEASE")
200
-                        echo sprintf(_("Release %s"), $RELEASE);
201
-                    else
202
-                        echo _("Unreleased SVN Revision");
199
+                    if ($RELEASE != "THERELEASE") {
200
+                                            echo sprintf(_("Release %s"), $RELEASE);
201
+                    } else {
202
+                                            echo _("Unreleased SVN Revision");
203
+                    }
203 204
                     echo " &copy; 2011-15 G&Eacute;ANT Ltd. on behalf of the GN3 and GN3plus consortia and others <a href='copyright.php'>Full Copyright and Licenses</a>";
204 205
                 ?>
205 206
                  </td>
206 207
                  <td style="padding-left:80px; padding-right:20px; text-align:right; vertical-align:top;">
207 208
                  <?php
208
-                     if (Config::$CONSORTIUM['name'] == "eduroam" && isset(Config::$CONSORTIUM['deployment-voodoo']) && Config::$CONSORTIUM['deployment-voodoo'] == "Operations Team") // SW: APPROVED
209
+                     if (Config::$CONSORTIUM['name'] == "eduroam" && isset(Config::$CONSORTIUM['deployment-voodoo']) && Config::$CONSORTIUM['deployment-voodoo'] == "Operations Team") {
210
+                         // SW: APPROVED
209 211
                          echo "
210 212
                   <span id='logos' style='position:fixed; left:50%;'><img src='resources/images/dante.png' alt='DANTE' style='height:23px;width:47px'/>
211 213
                   <img src='resources/images/eu.png' alt='EU' style='height:23px;width:27px;border-width:0px;'/></span>
212 214
                   <span id='eu_text' style='text-align:right;'><a href='http://ec.europa.eu/dgs/connect/index_en.htm' style='text-decoration:none; vertical-align:top;'>European Commission Communications Networks, Content and Technology</a></span>";
213
-                     else
214
-                         echo "&nbsp;";
215
+                     } else {
216
+                                              echo "&nbsp;";
217
+                     }
215 218
                  ?>
216 219
                 </td>
217 220
             </tr>
Please login to merge, or discard this patch.
web/404.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 <body>
27 27
     <div id="heading">
28 28
         <?php
29
-        print '<img src="'. dirname($_SERVER['SCRIPT_NAME']) .'/resources/images/consortium_logo.png" alt="Consortium Logo" style="float:right; padding-right:20px; padding-top:20px"/>';
30
-        print '<div id="motd">' . ( isset(Config::$APPEARANCE['MOTD']) ? Config::$APPEARANCE['MOTD'] : '&nbsp' ) . '</div>';
29
+        print '<img src="' . dirname($_SERVER['SCRIPT_NAME']) . '/resources/images/consortium_logo.png" alt="Consortium Logo" style="float:right; padding-right:20px; padding-top:20px"/>';
30
+        print '<div id="motd">' . (isset(Config::$APPEARANCE['MOTD']) ? Config::$APPEARANCE['MOTD'] : '&nbsp') . '</div>';
31 31
         print '<h1 style="padding-bottom:0px; height:1em;">' . sprintf(_("Welcome to %s"), Config::$APPEARANCE['productname']) . '</h1>
32 32
 <h2 style="padding-bottom:0px; height:0px; vertical-align:bottom;">' . Config::$APPEARANCE['productname_long'] . '</h2>';
33 33
         echo '<table id="lang_select"><tr><td>';
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
         ?>
42 42
     </div> <!-- id="heading" -->
43 43
     <div id="main_body" style='padding:20px;'>
44
-        <h1><?php echo _("This is not the CAT you are looking for.");?></h1>
45
-        <p><?php echo _("Whatever you expected to see at this URL - it's not here. The only thing here is the number");?></p>
44
+        <h1><?php echo _("This is not the CAT you are looking for."); ?></h1>
45
+        <p><?php echo _("Whatever you expected to see at this URL - it's not here. The only thing here is the number"); ?></p>
46 46
         <h2>404</h2>
47 47
         <p><?php echo sprintf(_("staring at you. Your mistake? Our error? Who knows! Maybe you should go back to the <a href='%s'>Start Page</a>."), dirname($_SERVER['SCRIPT_NAME']) . '?lang=' . CAT::get_lang())?></p>
48 48
     </div> <!-- id="main_body" -->
Please login to merge, or discard this patch.
web/diag/action_userdiag.php 1 patch
Braces   +23 added lines, -16 removed lines patch added patch discarded remove patch
@@ -67,10 +67,11 @@  discard block
 block discarded – undo
67 67
 
68 68
 function mainpage_url() {
69 69
     $main_url = valid_host($_SERVER['HTTP_HOST']);
70
-    if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on")
71
-        $main_url = "https://" . $main_url;
72
-    else
73
-        $main_url = "http://" . $main_url;
70
+    if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") {
71
+            $main_url = "https://" . $main_url;
72
+    } else {
73
+            $main_url = "http://" . $main_url;
74
+    }
74 75
     $main_url .= substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], "/diag/"));
75 76
     return $main_url;
76 77
 }
@@ -135,8 +136,9 @@  discard block
 block discarded – undo
135 136
                     array_multisort($name, SORT_ASC, SORT_LOCALE_STRING, $displaylist);
136 137
                     setlocale(LC_ALL, $current_locale);
137 138
 
138
-                    foreach ($displaylist as $id => $oneinst)
139
-                        echo "<option id='" . $id . "' value='" . $oneinst['realmlist'] . "'>" . $oneinst['name'] . "</option>";
139
+                    foreach ($displaylist as $id => $oneinst) {
140
+                                            echo "<option id='" . $id . "' value='" . $oneinst['realmlist'] . "'>" . $oneinst['name'] . "</option>";
141
+                    }
140 142
                     ?>
141 143
                 </select>
142 144
                 <button type='submit' class='submit'><?php echo _("Submit Information"); ?></button>
@@ -197,10 +199,12 @@  discard block
 block discarded – undo
197 199
                 $checkresult[$number] = $check['instance']->UDP_reachability($number, FALSE, FALSE);
198 200
                 if ($checkresult[$number] == RETVAL_CONVERSATION_REJECT) { // so now things work?!
199 201
                     // either a packet size or Operator-Name problem!
200
-                    if ($check['instance']->UDP_reachability($number, TRUE, FALSE) != RETVAL_CONVERSATION_REJECT)
201
-                        $realmproblems[] = ["REALM" => $check['realm'], "STATUS" => "OPERATOR-NAME", "FROM" => $probe['display_name'], "DETAIL" => ""];
202
-                    if ($check['instance']->UDP_reachability($number, FALSE, TRUE) != RETVAL_CONVERSATION_REJECT)
203
-                        $realmproblems[] = ["REALM" => $check['realm'], "STATUS" => "PACKETSIZE", "FROM" => $probe['display_name'], "DETAIL" => ""];
202
+                    if ($check['instance']->UDP_reachability($number, TRUE, FALSE) != RETVAL_CONVERSATION_REJECT) {
203
+                                            $realmproblems[] = ["REALM" => $check['realm'], "STATUS" => "OPERATOR-NAME", "FROM" => $probe['display_name'], "DETAIL" => ""];
204
+                    }
205
+                    if ($check['instance']->UDP_reachability($number, FALSE, TRUE) != RETVAL_CONVERSATION_REJECT) {
206
+                                            $realmproblems[] = ["REALM" => $check['realm'], "STATUS" => "PACKETSIZE", "FROM" => $probe['display_name'], "DETAIL" => ""];
207
+                    }
204 208
                 } else { // still no response or immediate reject
205 209
                     // if this is a CAT realm with anon ID set, we can't be seeing an NPS ignorance problem
206 210
                     // and consequently, the realm has actual issues
@@ -234,12 +238,13 @@  discard block
 block discarded – undo
234 238
 // re-write check history with that extra knowledge
235 239
     $copycat = $realmproblems;
236 240
 
237
-    foreach ($realmproblems as &$problem)
238
-        if ($problem['STATUS'] == "REALM_POSSIBLY_NPS")
241
+    foreach ($realmproblems as &$problem) {
242
+            if ($problem['STATUS'] == "REALM_POSSIBLY_NPS")
239 243
             foreach ($copycat as $otherproblem)
240 244
                 if ($problem['REALM'] == $otherproblem['REALM'] && $problem['FROM'] != $otherproblem['FROM'] && $otherproblem['STATUS'] != "REALM_POSSIBLY_NPS")
241 245
                     if ($otherproblem['STATUS'] == "REACHABLE") { // worked elsewhere, but not on this probe:
242 246
                         $problem['STATUS'] = "REALM_DOWN";
247
+    }
243 248
                     } else { // inherit other problem; in any case not an NPS problem
244 249
                         $problem['STATUS'] = $otherproblem['STATUS'];
245 250
                     }
@@ -249,11 +254,12 @@  discard block
 block discarded – undo
249 254
 
250 255
     $copycat = $realmproblems;
251 256
 
252
-    foreach ($realmproblems as &$problem)
253
-        if ($problem['STATUS'] == "REALM_DOWN")
257
+    foreach ($realmproblems as &$problem) {
258
+            if ($problem['STATUS'] == "REALM_DOWN")
254 259
             foreach ($copycat as $otherproblem)
255 260
                 if ($problem['REALM'] == $otherproblem['REALM'] && $problem['FROM'] != $otherproblem['FROM'] && $otherproblem['STATUS'] == "REACHABLE")
256 261
                     $problem['STATUS'] = "INFRASTRUCTURE";
262
+    }
257 263
     unset($problem);
258 264
 
259 265
 // finally, extract all certprobs we got from the reachability checks; merge from all
@@ -264,8 +270,9 @@  discard block
 block discarded – undo
264 270
     foreach ($checks as $check) {
265 271
         $instance = $check['instance'];
266 272
         $resultset = $instance->UDP_reachability_result;
267
-        foreach ($resultset as $result)
268
-            $all_certprobs = array_merge($all_certprobs, $result['cert_oddities']);
273
+        foreach ($resultset as $result) {
274
+                    $all_certprobs = array_merge($all_certprobs, $result['cert_oddities']);
275
+        }
269 276
     }
270 277
     echo "<pre>";
271 278
     print_r($realmproblems);
Please login to merge, or discard this patch.
web/4013.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 <body>
27 27
     <div id="heading">
28 28
         <?php
29
-        print '<img src="'. dirname($_SERVER['SCRIPT_NAME']) .'/resources/images/consortium_logo.png" alt="Consortium Logo" style="float:right; padding-right:20px; padding-top:20px"/>';
30
-        print '<div id="motd">' . ( isset(Config::$APPEARANCE['MOTD']) ? Config::$APPEARANCE['MOTD'] : '&nbsp' ) . '</div>';
29
+        print '<img src="' . dirname($_SERVER['SCRIPT_NAME']) . '/resources/images/consortium_logo.png" alt="Consortium Logo" style="float:right; padding-right:20px; padding-top:20px"/>';
30
+        print '<div id="motd">' . (isset(Config::$APPEARANCE['MOTD']) ? Config::$APPEARANCE['MOTD'] : '&nbsp') . '</div>';
31 31
         print '<h1 style="padding-bottom:0px; height:1em;">' . sprintf(_("Welcome to %s"), Config::$APPEARANCE['productname']) . '</h1>
32 32
 <h2 style="padding-bottom:0px; height:0px; vertical-align:bottom;">' . Config::$APPEARANCE['productname_long'] . '</h2>';
33 33
         echo '<table id="lang_select"><tr><td>';
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
         ?>
42 42
     </div> <!-- id="heading" -->
43 43
     <div id="main_body" style='padding:20px;'>
44
-        <h1><?php echo _("Maybe this is the CAT you are looking for...");?></h1>
45
-        <p><?php echo _("but we don't want to show it to you. You need to be authenticated and authorised to see this content. Since you are not, you got this error page usually known as");?></p>
44
+        <h1><?php echo _("Maybe this is the CAT you are looking for..."); ?></h1>
45
+        <p><?php echo _("but we don't want to show it to you. You need to be authenticated and authorised to see this content. Since you are not, you got this error page usually known as"); ?></p>
46 46
         <h2>401/403</h2>
47 47
         <p><?php echo sprintf(_("Your mistake? Our error? Who knows! Maybe you should go back to the <a href='%s'>Start Page</a>."), dirname($_SERVER['SCRIPT_NAME']) . '?lang=' . CAT::get_lang())?></p>
48 48
     </div> <!-- id="main_body" -->
Please login to merge, or discard this patch.
web/resources/css/cat.css.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 }
10 10
 
11 11
 body {
12
-    background: <?php echo $colour1;?>;
12
+    background: <?php echo $colour1; ?>;
13 13
     font-family:Verdana, Arial, Helvetica, sans-serif;
14 14
     font-size:11px;
15 15
     height: 100%;
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 }
24 24
 
25 25
 button {
26
-    background: <?php echo $colour2;?>; 
26
+    background: <?php echo $colour2; ?>; 
27 27
     color: #FFFFFF; 
28 28
     min-height: 23px;
29 29
     border-left-style: outset; 
@@ -205,9 +205,9 @@  discard block
 block discarded – undo
205 205
     border-bottom-style:solid;
206 206
     border-top-width:5px; 
207 207
     border-bottom-width:5px; 
208
-    border-color: <?php echo $colour1;?>;
208
+    border-color: <?php echo $colour1; ?>;
209 209
     padding-left:30px;
210
-    color: <?php echo $colour2;?>;
210
+    color: <?php echo $colour2; ?>;
211 211
 }
212 212
 
213 213
 div.pagecontent {
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 
401 401
 span.edu_cat {
402 402
     font-weight: bold;
403
-    color: <?php echo $colour2;?>;
403
+    color: <?php echo $colour2; ?>;
404 404
 }
405 405
 
406 406
 span.tooltip {
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
     border-bottom-style:solid;
514 514
     border-top-width:5px; 
515 515
     border-bottom-width:5px; 
516
-    border-color: <?php echo $colour1;?>; 
516
+    border-color: <?php echo $colour1; ?>; 
517 517
     padding-left:30px;
518 518
 }
519 519
 
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 }
568 568
 
569 569
 span.redirect_link {
570
-    background: <?php echo $colour2;?>; color: #FFFFFF; height: 23px;
570
+    background: <?php echo $colour2; ?>; color: #FFFFFF; height: 23px;
571 571
     border-left-style: inset; border-left-width: 1px; border-left-color: #8bbacb;
572 572
     border-top-style: inset; border-top-width: 1px; border-top-color: #8bbacb;
573 573
     border-right-style: outset; border-right-width: 2px; border-right-color: #043d52;
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
 }
615 615
 
616 616
 #close_button {
617
-    background: <?php echo $colour2;?>; 
617
+    background: <?php echo $colour2; ?>; 
618 618
     color: #FFFFFF; 
619 619
     height: 23px;
620 620
     border-left-style: inset; 
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
     width: 30em; 
696 696
     padding-left: 10px; 
697 697
     padding-right: 0px; 
698
-    background: <?php echo $colour2;?>; 
698
+    background: <?php echo $colour2; ?>; 
699 699
     color: white; 
700 700
     box-shadow: 10px 10px 5px #888888;
701 701
 }
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
     width: 30em; 
705 705
     padding-left: 10px; 
706 706
     padding-right: 00px; 
707
-    background: <?php echo $colour2;?>; 
707
+    background: <?php echo $colour2; ?>; 
708 708
     color: #FFFFFF; 
709 709
     box-shadow: 10px 10px 5px #888888;
710 710
 }
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
     padding-top: 4px; 
760 760
     padding-bottom: 12px; 
761 761
     padding-left: 30px; 
762
-    background: <?php echo $colour1;?>; 
762
+    background: <?php echo $colour1; ?>; 
763 763
     text-align: left; 
764 764
     text-shadow: 10px 10px 5px #888888;
765 765
 }
@@ -769,9 +769,9 @@  discard block
 block discarded – undo
769 769
     border-bottom-style:solid;
770 770
     border-top-width:5px;
771 771
     border-bottom-width:5px;
772
-    border-color: <?php echo $colour1;?>;
772
+    border-color: <?php echo $colour1; ?>;
773 773
     padding-left:30px;
774
-    color: <?php echo $colour2;?>;
774
+    color: <?php echo $colour2; ?>;
775 775
 }
776 776
 
777 777
 #heading h1 { 
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
     text-align: justify;
791 791
     border-bottom-style:solid;
792 792
     border-bottom-width:5px;
793
-    border-color: <?php echo $colour1;?>;
793
+    border-color: <?php echo $colour1; ?>;
794 794
     font-size: 11px;
795 795
     font-weight: normal;
796 796
 }
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 
839 839
 #faq {
840 840
     padding: 20px;
841
-    color: <?php echo $colour2;?>;
841
+    color: <?php echo $colour2; ?>;
842 842
     background: #ffffff;
843 843
 }
844 844
 
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
 
892 892
 #line1 {
893 893
     top:145px;
894
-    color: <?php echo $colour2;?>;
894
+    color: <?php echo $colour2; ?>;
895 895
     font-size:20px;
896 896
 }
897 897
 
@@ -946,7 +946,7 @@  discard block
 block discarded – undo
946 946
 
947 947
 #menu_column {
948 948
     border-right:solid;
949
-    border-color: <?php echo $colour1;?>;
949
+    border-color: <?php echo $colour1; ?>;
950 950
     border-width:5px;
951 951
     min-height:400px;
952 952
     padding-left: 10px;
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
 
958 958
 #front_page_leftmenu {
959 959
     border-right:solid; 
960
-    border-color: <?php echo $colour1;?>; 
960
+    border-color: <?php echo $colour1; ?>; 
961 961
     border-width:5px; 
962 962
     min-height:400px; 
963 963
     padding-left: 10px; 
@@ -986,11 +986,11 @@  discard block
 block discarded – undo
986 986
 }
987 987
 
988 988
 a:link {
989
-    color:<?php echo $colour2;?>;
989
+    color:<?php echo $colour2; ?>;
990 990
 }
991 991
 
992 992
 a:visited {
993
-    color:<?php echo $colour2;?>;
993
+    color:<?php echo $colour2; ?>;
994 994
 }
995 995
 
996 996
 a:hover {
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
 }
999 999
 
1000 1000
 a:active {
1001
-    color:<?php echo $colour2;?>;
1001
+    color:<?php echo $colour2; ?>;
1002 1002
 }
1003 1003
 
1004 1004
 .comment {
Please login to merge, or discard this patch.
web/resources/css/cat-basic.css.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
    font-size:25px;
22 22
    font-size:5vw;
23 23
    width: 100%;
24
-   background: <?php echo $colour2;?>;
24
+   background: <?php echo $colour2; ?>;
25 25
    color: #ffffff;
26 26
 }
27 27
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
    font-size:25px;
49 49
    font-size:5vw;
50 50
    width: 100%;
51
-   background: <?php echo $colour2;?>;
51
+   background: <?php echo $colour2; ?>;
52 52
    color: #ffffff;
53 53
    border-radius:10px ; 
54 54
    border-radius:2vw ; 
Please login to merge, or discard this patch.
utils/notify_invitation_expiry.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
             $mailtext .= "$instname\n";
50 50
 
51 51
         if ($numberofexistingidps > 0)
52
-            $mailtext .="
52
+            $mailtext .= "
53 53
 
54 54
 Additionally, $numberofexistingidps invitations for existing institutions have expired.
55 55
 ";
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,14 +45,16 @@
 block discarded – undo
45 45
 invitation tokens for the following new institutions have recently expired:
46 46
 
47 47
 ";
48
-        foreach ($listofinstnames as $instname)
49
-            $mailtext .= "$instname\n";
48
+        foreach ($listofinstnames as $instname) {
49
+                    $mailtext .= "$instname\n";
50
+        }
50 51
 
51
-        if ($numberofexistingidps > 0)
52
-            $mailtext .="
52
+        if ($numberofexistingidps > 0) {
53
+                    $mailtext .="
53 54
 
54 55
 Additionally, $numberofexistingidps invitations for existing institutions have expired.
55 56
 ";
57
+        }
56 58
         $mailtext .= "
57 59
 We thought you might like to know.
58 60
 
Please login to merge, or discard this patch.
core/DeviceFactory.php 3 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -47,24 +47,24 @@
 block discarded – undo
47 47
     public function __construct($blueprint) {
48 48
 
49 49
       $Dev = Devices::listDevices();
50
-        if(isset($Dev[$blueprint])) {
51
-            if($Dev[$blueprint]['directory'] && $Dev[$blueprint]['module'])
52
-                require_once("devices/".$Dev[$blueprint]['directory']."/".$Dev[$blueprint]['module'].".php");
53
-            debug(4,"loaded: devices/".$Dev[$blueprint]['directory']."/".$Dev[$blueprint]['module'].".php\n");
54
-            $class_name = "Device_".$Dev[$blueprint]['module'];
50
+        if (isset($Dev[$blueprint])) {
51
+            if ($Dev[$blueprint]['directory'] && $Dev[$blueprint]['module'])
52
+                require_once("devices/" . $Dev[$blueprint]['directory'] . "/" . $Dev[$blueprint]['module'] . ".php");
53
+            debug(4, "loaded: devices/" . $Dev[$blueprint]['directory'] . "/" . $Dev[$blueprint]['module'] . ".php\n");
54
+            $class_name = "Device_" . $Dev[$blueprint]['module'];
55 55
             $this->device = new $class_name();
56
-            if(! $this->device) {
57
-                debug(2,"module loading failed");
56
+            if (!$this->device) {
57
+                debug(2, "module loading failed");
58 58
                 die("module loading failed");
59 59
             }
60 60
         } else {
61 61
             error("unknown devicename:$blueprint");
62 62
         }
63
-       $this->device->module_path = CAT::$root.'/devices/'.$Dev[$blueprint]['directory'];
63
+       $this->device->module_path = CAT::$root . '/devices/' . $Dev[$blueprint]['directory'];
64 64
        $this->device->signer = isset($Dev[$blueprint]['signer']) ? $Dev[$blueprint]['signer'] : 0; 
65 65
        $this->device->device_id = $blueprint;
66 66
        $options = Devices::$Options;
67
-       if(isset($Dev[$blueprint]['options'])) {
67
+       if (isset($Dev[$blueprint]['options'])) {
68 68
           $Opt = $Dev[$blueprint]['options'];
69 69
           foreach ($Opt as $option => $value)
70 70
             $options[$option] = $value;
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -48,8 +48,9 @@  discard block
 block discarded – undo
48 48
 
49 49
       $Dev = Devices::listDevices();
50 50
         if(isset($Dev[$blueprint])) {
51
-            if($Dev[$blueprint]['directory'] && $Dev[$blueprint]['module'])
52
-                require_once("devices/".$Dev[$blueprint]['directory']."/".$Dev[$blueprint]['module'].".php");
51
+            if($Dev[$blueprint]['directory'] && $Dev[$blueprint]['module']) {
52
+                            require_once("devices/".$Dev[$blueprint]['directory']."/".$Dev[$blueprint]['module'].".php");
53
+            }
53 54
             debug(4,"loaded: devices/".$Dev[$blueprint]['directory']."/".$Dev[$blueprint]['module'].".php\n");
54 55
             $class_name = "Device_".$Dev[$blueprint]['module'];
55 56
             $this->device = new $class_name();
@@ -66,8 +67,9 @@  discard block
 block discarded – undo
66 67
        $options = Devices::$Options;
67 68
        if(isset($Dev[$blueprint]['options'])) {
68 69
           $Opt = $Dev[$blueprint]['options'];
69
-          foreach ($Opt as $option => $value)
70
-            $options[$option] = $value;
70
+          foreach ($Opt as $option => $value) {
71
+                      $options[$option] = $value;
72
+          }
71 73
        }
72 74
        $this->device->options = $options;
73 75
     }
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function __construct($blueprint) {
48 48
 
49
-      $Dev = Devices::listDevices();
49
+        $Dev = Devices::listDevices();
50 50
         if(isset($Dev[$blueprint])) {
51 51
             if($Dev[$blueprint]['directory'] && $Dev[$blueprint]['module'])
52 52
                 require_once("devices/".$Dev[$blueprint]['directory']."/".$Dev[$blueprint]['module'].".php");
@@ -60,15 +60,15 @@  discard block
 block discarded – undo
60 60
         } else {
61 61
             error("unknown devicename:$blueprint");
62 62
         }
63
-       $this->device->module_path = CAT::$root.'/devices/'.$Dev[$blueprint]['directory'];
64
-       $this->device->signer = isset($Dev[$blueprint]['signer']) ? $Dev[$blueprint]['signer'] : 0; 
65
-       $this->device->device_id = $blueprint;
66
-       $options = Devices::$Options;
67
-       if(isset($Dev[$blueprint]['options'])) {
68
-          $Opt = $Dev[$blueprint]['options'];
69
-          foreach ($Opt as $option => $value)
63
+        $this->device->module_path = CAT::$root.'/devices/'.$Dev[$blueprint]['directory'];
64
+        $this->device->signer = isset($Dev[$blueprint]['signer']) ? $Dev[$blueprint]['signer'] : 0; 
65
+        $this->device->device_id = $blueprint;
66
+        $options = Devices::$Options;
67
+        if(isset($Dev[$blueprint]['options'])) {
68
+            $Opt = $Dev[$blueprint]['options'];
69
+            foreach ($Opt as $option => $value)
70 70
             $options[$option] = $value;
71
-       }
72
-       $this->device->options = $options;
71
+        }
72
+        $this->device->options = $options;
73 73
     }
74 74
 }
75 75
\ No newline at end of file
Please login to merge, or discard this patch.
core/X509.php 3 patches
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -33,42 +33,42 @@  discard block
 block discarded – undo
33 33
  *  @author http://php.net/manual/en/ref.openssl.php (comment from 29-Mar-2007)
34 34
  */
35 35
 public function pem2der($pem_data) {
36
-   $begin = "CERTIFICATE-----";
37
-   $end   = "-----END";
38
-   $pem_data = substr($pem_data, strpos($pem_data, $begin)+strlen($begin));
39
-   $pem_data = substr($pem_data, 0, strpos($pem_data, $end));
40
-   $der = base64_decode($pem_data);
41
-   return $der;
36
+    $begin = "CERTIFICATE-----";
37
+    $end   = "-----END";
38
+    $pem_data = substr($pem_data, strpos($pem_data, $begin)+strlen($begin));
39
+    $pem_data = substr($pem_data, 0, strpos($pem_data, $end));
40
+    $der = base64_decode($pem_data);
41
+    return $der;
42 42
 }
43 43
 
44 44
 public function der2pem($der_data) {
45
-   $pem = chunk_split(base64_encode($der_data), 64, "\n");
46
-   $pem = "-----BEGIN CERTIFICATE-----\n".$pem."-----END CERTIFICATE-----\n";
47
-   return $pem;
45
+    $pem = chunk_split(base64_encode($der_data), 64, "\n");
46
+    $pem = "-----BEGIN CERTIFICATE-----\n".$pem."-----END CERTIFICATE-----\n";
47
+    return $pem;
48 48
 }
49 49
 /**
50
-  * prepare PEM and DER formats, MD5 and SHA1 fingerprints and subject of the certificate
51
-  *
52
-  * returns an array with the following fields:
53
-  * <pre> uuid
54
-  * pem	certificate in PEM format
55
-  * der	certificate in DER format
56
-  * md5	MD5 fingerprint
57
-  * sha1	SHA1 fingerprint
58
-  * name	certificate subject
59
-  * root value 1 if root certificate 0 otherwise
60
-  * ca   value 1 if CA certificate 0 otherwise
61
-  *
62
-  * </pre>
63
-  * @param blob $cadata certificate in ether PEM or DER format
64
-  * @return array
65
-  */
50
+ * prepare PEM and DER formats, MD5 and SHA1 fingerprints and subject of the certificate
51
+ *
52
+ * returns an array with the following fields:
53
+ * <pre> uuid
54
+ * pem	certificate in PEM format
55
+ * der	certificate in DER format
56
+ * md5	MD5 fingerprint
57
+ * sha1	SHA1 fingerprint
58
+ * name	certificate subject
59
+ * root value 1 if root certificate 0 otherwise
60
+ * ca   value 1 if CA certificate 0 otherwise
61
+ *
62
+ * </pre>
63
+ * @param blob $cadata certificate in ether PEM or DER format
64
+ * @return array
65
+ */
66 66
 public function processCertificate ($cadata) {
67 67
     $begin_pem = strpos($cadata,"-----BEGIN CERTIFICATE-----");
68
-   if($begin_pem !== FALSE) {
68
+    if($begin_pem !== FALSE) {
69 69
         $end_c = strpos($cadata,"-----END CERTIFICATE-----") + 25;
70 70
         if($end_c !== FALSE) {
71
-           $cadata = substr($cadata,$begin_pem,$end_c - $begin_pem);
71
+            $cadata = substr($cadata,$begin_pem,$end_c - $begin_pem);
72 72
         }
73 73
         $ca_der = X509::pem2der($cadata);
74 74
         $ca_pem = X509::der2pem($ca_der);
@@ -91,25 +91,25 @@  discard block
 block discarded – undo
91 91
     $out =  ["uuid" => uuid(), "pem" => $ca_pem, "der" => $ca_der, "md5"=>$md5, "sha1"=>$sha1, "name"=>$mydetails['name']];
92 92
     $diff_a = array_diff($mydetails['issuer'], $mydetails['subject']);
93 93
     if(count($diff_a) == 0 ) {
94
-     $out['root'] = 1;
95
-     $mydetails['type'] = 'root';
94
+        $out['root'] = 1;
95
+        $mydetails['type'] = 'root';
96 96
     } else {
97
-     $out['root'] = 0;
97
+        $out['root'] = 0;
98 98
     }
99 99
     // if no basicContraints are set at all, this is a problem in itself
100 100
     // is this a CA? or not? Treat as server, but add a warning...
101 101
     if (isset($mydetails['extensions']['basicConstraints'])) {
102
-       $out['ca'] = preg_match('/^CA:TRUE/',$mydetails['extensions']['basicConstraints']);
103
-       $out['basicconstraints_set'] = 1;
102
+        $out['ca'] = preg_match('/^CA:TRUE/',$mydetails['extensions']['basicConstraints']);
103
+        $out['basicconstraints_set'] = 1;
104 104
     } else {
105
-       $out['ca'] = 0; // we need to resolve this ambiguity
106
-       $out['basicconstraints_set'] = 0;
105
+        $out['ca'] = 0; // we need to resolve this ambiguity
106
+        $out['basicconstraints_set'] = 0;
107 107
     }
108 108
     
109 109
     if( $out['ca'] > 0 && $out['root'] == 0 )
110
-     $mydetails['type'] = 'interm_ca';
110
+        $mydetails['type'] = 'interm_ca';
111 111
     if( $out['ca'] == 0 && $out['root'] == 0 )
112
-     $mydetails['type'] = 'server';
112
+        $mydetails['type'] = 'server';
113 113
     $mydetails['sha1'] = $sha1;
114 114
     $out['full_details'] = $mydetails;
115 115
     
@@ -119,51 +119,51 @@  discard block
 block discarded – undo
119 119
     
120 120
     openssl_x509_export($myca, $output, FALSE);
121 121
     if(preg_match('/^\s+Signature Algorithm:\s*(.*)\s*$/m', $output, $match)) 
122
-      $out['full_details']['signature_algorithm'] = $match[1];
122
+        $out['full_details']['signature_algorithm'] = $match[1];
123 123
     else
124
-      $out['full_details']['signature_algorithm'] = $output;
124
+        $out['full_details']['signature_algorithm'] = $output;
125 125
  
126 126
     if((preg_match('/^\s+Public-Key:\s*\((.*) bit\)\s*$/m', $output, $match)) && is_numeric($match[1])) 
127
-      $out['full_details']['public_key_length'] = $match[1];
127
+        $out['full_details']['public_key_length'] = $match[1];
128 128
     else
129
-      $out['full_details']['public_key_length'] = $output;
129
+        $out['full_details']['public_key_length'] = $output;
130 130
     
131 131
     return $out;
132 132
 }
133 133
 
134 134
 /**
135
-  * split a certificate file into components 
136
-  *
137
-  * returns an array containing the PEM format of the certificate (s)
138
-  * if the file contains multiple certificates it gets split into components
139
-  *
140
-  * @param blob $cadata certificate in ether PEM or DER format
141
-  * @return array
142
-  */
135
+ * split a certificate file into components 
136
+ *
137
+ * returns an array containing the PEM format of the certificate (s)
138
+ * if the file contains multiple certificates it gets split into components
139
+ *
140
+ * @param blob $cadata certificate in ether PEM or DER format
141
+ * @return array
142
+ */
143 143
 
144 144
 public function splitCertificate($cadata) {
145
-  $returnarray = [];
146
-  // maybe we got no real cert data at all? The code is hardened, but will
147
-  // produce ugly WARNING level output in the logfiles, so let's avoid at least
148
-  // the trivial case: if the file is empty, there's no cert in it
149
-  if ($cadata == "")
150
-      return $returnarray;
151
-  $start_c = strpos($cadata,"-----BEGIN CERTIFICATE-----" );
152
-  if( $start_c !== FALSE) {
145
+    $returnarray = [];
146
+    // maybe we got no real cert data at all? The code is hardened, but will
147
+    // produce ugly WARNING level output in the logfiles, so let's avoid at least
148
+    // the trivial case: if the file is empty, there's no cert in it
149
+    if ($cadata == "")
150
+        return $returnarray;
151
+    $start_c = strpos($cadata,"-----BEGIN CERTIFICATE-----" );
152
+    if( $start_c !== FALSE) {
153 153
         $cadata = substr($cadata,$start_c);
154 154
         $end_c = strpos($cadata,"-----END CERTIFICATE-----") + 25;
155 155
         $next_c = strpos($cadata,"-----BEGIN CERTIFICATE-----",30);
156 156
         while ( $next_c !== FALSE) {
157
-          $returnarray[] = substr($cadata,0,$end_c);
158
-          $cadata = substr($cadata,$next_c);
159
-          $end_c = strpos($cadata,"-----END CERTIFICATE-----") + 25;
160
-          $next_c = strpos($cadata,"-----BEGIN CERTIFICATE-----",30);
157
+            $returnarray[] = substr($cadata,0,$end_c);
158
+            $cadata = substr($cadata,$next_c);
159
+            $end_c = strpos($cadata,"-----END CERTIFICATE-----") + 25;
160
+            $next_c = strpos($cadata,"-----BEGIN CERTIFICATE-----",30);
161 161
         }
162 162
         $returnarray[] = substr($cadata,0,$end_c);
163 163
     } else {
164 164
         // TODO: before we blindly hand it over to der2pem - is this valid DER
165 165
         // data at all?
166
-      $returnarray[] = X509::der2pem($cadata);
166
+        $returnarray[] = X509::der2pem($cadata);
167 167
     }
168 168
     // print_r($returnarray);
169 169
     
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 public function pem2der($pem_data) {
36 36
    $begin = "CERTIFICATE-----";
37 37
    $end   = "-----END";
38
-   $pem_data = substr($pem_data, strpos($pem_data, $begin)+strlen($begin));
38
+   $pem_data = substr($pem_data, strpos($pem_data, $begin) + strlen($begin));
39 39
    $pem_data = substr($pem_data, 0, strpos($pem_data, $end));
40 40
    $der = base64_decode($pem_data);
41 41
    return $der;
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
 public function der2pem($der_data) {
45 45
    $pem = chunk_split(base64_encode($der_data), 64, "\n");
46
-   $pem = "-----BEGIN CERTIFICATE-----\n".$pem."-----END CERTIFICATE-----\n";
46
+   $pem = "-----BEGIN CERTIFICATE-----\n" . $pem . "-----END CERTIFICATE-----\n";
47 47
    return $pem;
48 48
 }
49 49
 /**
@@ -63,19 +63,19 @@  discard block
 block discarded – undo
63 63
   * @param blob $cadata certificate in ether PEM or DER format
64 64
   * @return array
65 65
   */
66
-public function processCertificate ($cadata) {
67
-    $begin_pem = strpos($cadata,"-----BEGIN CERTIFICATE-----");
68
-   if($begin_pem !== FALSE) {
69
-        $end_c = strpos($cadata,"-----END CERTIFICATE-----") + 25;
70
-        if($end_c !== FALSE) {
71
-           $cadata = substr($cadata,$begin_pem,$end_c - $begin_pem);
66
+public function processCertificate($cadata) {
67
+    $begin_pem = strpos($cadata, "-----BEGIN CERTIFICATE-----");
68
+   if ($begin_pem !== FALSE) {
69
+        $end_c = strpos($cadata, "-----END CERTIFICATE-----") + 25;
70
+        if ($end_c !== FALSE) {
71
+           $cadata = substr($cadata, $begin_pem, $end_c - $begin_pem);
72 72
         }
73 73
         $ca_der = X509::pem2der($cadata);
74 74
         $ca_pem = X509::der2pem($ca_der);
75 75
         // echo "XXXXXXXXXXXXX".$cadata."XXXXXXXXXXXXX"; exit;
76 76
     } else {
77 77
         $ca_der = $cadata;
78
-        $ca_pem =  X509::der2pem($cadata);
78
+        $ca_pem = X509::der2pem($cadata);
79 79
     }
80 80
 
81 81
     # check that the certificate is OK
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
     $mydetails = openssl_x509_parse($myca);
87 87
     if (!isset($mydetails['subject']))
88 88
         return FALSE;
89
-    $md5 = openssl_digest($ca_der,'MD5');
90
-    $sha1 = openssl_digest($ca_der,'SHA1');
91
-    $out =  ["uuid" => uuid(), "pem" => $ca_pem, "der" => $ca_der, "md5"=>$md5, "sha1"=>$sha1, "name"=>$mydetails['name']];
89
+    $md5 = openssl_digest($ca_der, 'MD5');
90
+    $sha1 = openssl_digest($ca_der, 'SHA1');
91
+    $out = ["uuid" => uuid(), "pem" => $ca_pem, "der" => $ca_der, "md5"=>$md5, "sha1"=>$sha1, "name"=>$mydetails['name']];
92 92
     $diff_a = array_diff($mydetails['issuer'], $mydetails['subject']);
93
-    if(count($diff_a) == 0 ) {
93
+    if (count($diff_a) == 0) {
94 94
      $out['root'] = 1;
95 95
      $mydetails['type'] = 'root';
96 96
     } else {
@@ -99,16 +99,16 @@  discard block
 block discarded – undo
99 99
     // if no basicContraints are set at all, this is a problem in itself
100 100
     // is this a CA? or not? Treat as server, but add a warning...
101 101
     if (isset($mydetails['extensions']['basicConstraints'])) {
102
-       $out['ca'] = preg_match('/^CA:TRUE/',$mydetails['extensions']['basicConstraints']);
102
+       $out['ca'] = preg_match('/^CA:TRUE/', $mydetails['extensions']['basicConstraints']);
103 103
        $out['basicconstraints_set'] = 1;
104 104
     } else {
105 105
        $out['ca'] = 0; // we need to resolve this ambiguity
106 106
        $out['basicconstraints_set'] = 0;
107 107
     }
108 108
     
109
-    if( $out['ca'] > 0 && $out['root'] == 0 )
109
+    if ($out['ca'] > 0 && $out['root'] == 0)
110 110
      $mydetails['type'] = 'interm_ca';
111
-    if( $out['ca'] == 0 && $out['root'] == 0 )
111
+    if ($out['ca'] == 0 && $out['root'] == 0)
112 112
      $mydetails['type'] = 'server';
113 113
     $mydetails['sha1'] = $sha1;
114 114
     $out['full_details'] = $mydetails;
@@ -118,12 +118,12 @@  discard block
 block discarded – undo
118 118
     
119 119
     
120 120
     openssl_x509_export($myca, $output, FALSE);
121
-    if(preg_match('/^\s+Signature Algorithm:\s*(.*)\s*$/m', $output, $match)) 
121
+    if (preg_match('/^\s+Signature Algorithm:\s*(.*)\s*$/m', $output, $match)) 
122 122
       $out['full_details']['signature_algorithm'] = $match[1];
123 123
     else
124 124
       $out['full_details']['signature_algorithm'] = $output;
125 125
  
126
-    if((preg_match('/^\s+Public-Key:\s*\((.*) bit\)\s*$/m', $output, $match)) && is_numeric($match[1])) 
126
+    if ((preg_match('/^\s+Public-Key:\s*\((.*) bit\)\s*$/m', $output, $match)) && is_numeric($match[1])) 
127 127
       $out['full_details']['public_key_length'] = $match[1];
128 128
     else
129 129
       $out['full_details']['public_key_length'] = $output;
@@ -148,18 +148,18 @@  discard block
 block discarded – undo
148 148
   // the trivial case: if the file is empty, there's no cert in it
149 149
   if ($cadata == "")
150 150
       return $returnarray;
151
-  $start_c = strpos($cadata,"-----BEGIN CERTIFICATE-----" );
152
-  if( $start_c !== FALSE) {
153
-        $cadata = substr($cadata,$start_c);
154
-        $end_c = strpos($cadata,"-----END CERTIFICATE-----") + 25;
155
-        $next_c = strpos($cadata,"-----BEGIN CERTIFICATE-----",30);
156
-        while ( $next_c !== FALSE) {
157
-          $returnarray[] = substr($cadata,0,$end_c);
158
-          $cadata = substr($cadata,$next_c);
159
-          $end_c = strpos($cadata,"-----END CERTIFICATE-----") + 25;
160
-          $next_c = strpos($cadata,"-----BEGIN CERTIFICATE-----",30);
151
+  $start_c = strpos($cadata, "-----BEGIN CERTIFICATE-----");
152
+  if ($start_c !== FALSE) {
153
+        $cadata = substr($cadata, $start_c);
154
+        $end_c = strpos($cadata, "-----END CERTIFICATE-----") + 25;
155
+        $next_c = strpos($cadata, "-----BEGIN CERTIFICATE-----", 30);
156
+        while ($next_c !== FALSE) {
157
+          $returnarray[] = substr($cadata, 0, $end_c);
158
+          $cadata = substr($cadata, $next_c);
159
+          $end_c = strpos($cadata, "-----END CERTIFICATE-----") + 25;
160
+          $next_c = strpos($cadata, "-----BEGIN CERTIFICATE-----", 30);
161 161
         }
162
-        $returnarray[] = substr($cadata,0,$end_c);
162
+        $returnarray[] = substr($cadata, 0, $end_c);
163 163
     } else {
164 164
         // TODO: before we blindly hand it over to der2pem - is this valid DER
165 165
         // data at all?
Please login to merge, or discard this patch.
Braces   +25 added lines, -18 removed lines patch added patch discarded remove patch
@@ -81,11 +81,13 @@  discard block
 block discarded – undo
81 81
     # check that the certificate is OK
82 82
 //print "<pre>CA:\n$ca_pem</pre>\n";
83 83
     $myca = openssl_x509_read($ca_pem);
84
-    if ($myca == FALSE) 
85
-        return FALSE;
84
+    if ($myca == FALSE) {
85
+            return FALSE;
86
+    }
86 87
     $mydetails = openssl_x509_parse($myca);
87
-    if (!isset($mydetails['subject']))
88
-        return FALSE;
88
+    if (!isset($mydetails['subject'])) {
89
+            return FALSE;
90
+    }
89 91
     $md5 = openssl_digest($ca_der,'MD5');
90 92
     $sha1 = openssl_digest($ca_der,'SHA1');
91 93
     $out =  ["uuid" => uuid(), "pem" => $ca_pem, "der" => $ca_der, "md5"=>$md5, "sha1"=>$sha1, "name"=>$mydetails['name']];
@@ -106,10 +108,12 @@  discard block
 block discarded – undo
106 108
        $out['basicconstraints_set'] = 0;
107 109
     }
108 110
     
109
-    if( $out['ca'] > 0 && $out['root'] == 0 )
110
-     $mydetails['type'] = 'interm_ca';
111
-    if( $out['ca'] == 0 && $out['root'] == 0 )
112
-     $mydetails['type'] = 'server';
111
+    if( $out['ca'] > 0 && $out['root'] == 0 ) {
112
+         $mydetails['type'] = 'interm_ca';
113
+    }
114
+    if( $out['ca'] == 0 && $out['root'] == 0 ) {
115
+         $mydetails['type'] = 'server';
116
+    }
113 117
     $mydetails['sha1'] = $sha1;
114 118
     $out['full_details'] = $mydetails;
115 119
     
@@ -118,15 +122,17 @@  discard block
 block discarded – undo
118 122
     
119 123
     
120 124
     openssl_x509_export($myca, $output, FALSE);
121
-    if(preg_match('/^\s+Signature Algorithm:\s*(.*)\s*$/m', $output, $match)) 
122
-      $out['full_details']['signature_algorithm'] = $match[1];
123
-    else
124
-      $out['full_details']['signature_algorithm'] = $output;
125
+    if(preg_match('/^\s+Signature Algorithm:\s*(.*)\s*$/m', $output, $match)) {
126
+          $out['full_details']['signature_algorithm'] = $match[1];
127
+    } else {
128
+          $out['full_details']['signature_algorithm'] = $output;
129
+    }
125 130
  
126
-    if((preg_match('/^\s+Public-Key:\s*\((.*) bit\)\s*$/m', $output, $match)) && is_numeric($match[1])) 
127
-      $out['full_details']['public_key_length'] = $match[1];
128
-    else
129
-      $out['full_details']['public_key_length'] = $output;
131
+    if((preg_match('/^\s+Public-Key:\s*\((.*) bit\)\s*$/m', $output, $match)) && is_numeric($match[1])) {
132
+          $out['full_details']['public_key_length'] = $match[1];
133
+    } else {
134
+          $out['full_details']['public_key_length'] = $output;
135
+    }
130 136
     
131 137
     return $out;
132 138
 }
@@ -146,8 +152,9 @@  discard block
 block discarded – undo
146 152
   // maybe we got no real cert data at all? The code is hardened, but will
147 153
   // produce ugly WARNING level output in the logfiles, so let's avoid at least
148 154
   // the trivial case: if the file is empty, there's no cert in it
149
-  if ($cadata == "")
150
-      return $returnarray;
155
+  if ($cadata == "") {
156
+        return $returnarray;
157
+  }
151 158
   $start_c = strpos($cadata,"-----BEGIN CERTIFICATE-----" );
152 159
   if( $start_c !== FALSE) {
153 160
         $cadata = substr($cadata,$start_c);
Please login to merge, or discard this patch.