Completed
Push — master ( 3431fa...0cf71b )
by Joe
02:31
created
src/Cpanel.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -3,24 +3,24 @@  discard block
 block discarded – undo
3 3
 namespace Detain\Cpanel;
4 4
 
5 5
 class Cpanel {
6
-	public $format;
7
-	public $curl;
8
-	public $opts;
6
+    public $format;
7
+    public $curl;
8
+    public $opts;
9 9
 
10 10
     public function __construct ($user, $pass) {
11 11
         if (!function_exists('curl_init')) {
12 12
             die("cPanelLicensing requires that curl+ssl support is compiled into the PHP interpreter");
13 13
         }
14
-		$this->opts = [];
14
+        $this->opts = [];
15 15
         $this->format = "simplexml";
16 16
         $this->setCredentials($user, $pass);
17 17
         $this->setopt(CURLOPT_RETURNTRANSFER,1);
18 18
         $this->setopt(CURLOPT_USERAGENT, 'cPanel Licensing Agent (php) 3.5' );
19 19
     }
20 20
 
21
-	public function setopt($option, $value) {
22
-		$this->opts[$option] = $value;
23
-	}
21
+    public function setopt($option, $value) {
22
+        $this->opts[$option] = $value;
23
+    }
24 24
 
25 25
     public function setCredentials ($user, $pass) {
26 26
         $this->setopt(CURLOPT_USERPWD, $user . ":" . $pass);
@@ -46,42 +46,42 @@  discard block
 block discarded – undo
46 46
         }
47 47
         $query = "https://manage2.cpanel.net/" . $function . "?" . http_build_query($args);
48 48
         $this->setopt(CURLOPT_URL, $query);
49
-		$this->curl = curl_init();
50
-		foreach ($this->opts as $option => $value) {
51
-			curl_setopt($this->curl, $option, $value);
52
-		}
49
+        $this->curl = curl_init();
50
+        foreach ($this->opts as $option => $value) {
51
+            curl_setopt($this->curl, $option, $value);
52
+        }
53 53
         $result = curl_exec($this->curl);
54
-		curl_close($this->curl);
54
+        curl_close($this->curl);
55 55
         if ($result == false) {
56 56
             error_log("cPanelLicensing::get failed: \"" . curl_error($this->curl) . "\"");
57 57
             return;
58 58
         }
59 59
         if ($this->format == "simplexml") {
60
-			function_requirements('xml2array');
61
-			$result = xml2array($result, 1, 'attribute');
62
-			$result = $result[str_replace('.cgi', '', $function)];
63
-			$result = $this->format_result($result);			
64
-			return $result;
60
+            function_requirements('xml2array');
61
+            $result = xml2array($result, 1, 'attribute');
62
+            $result = $result[str_replace('.cgi', '', $function)];
63
+            $result = $this->format_result($result);			
64
+            return $result;
65 65
         }
66 66
         else {
67 67
             return $result;
68 68
         }
69 69
     }
70 70
 
71
-	private function format_result($result) {
72
-		if (is_array($result)) {
73
-			foreach ($result as $key => $value) {
74
-				if (is_array($value)) {
75
-					if (isset($value['attr']) && is_array($value['attr'])) {
76
-						$result[$key] = $value['attr'];
77
-					} else {
78
-						$result[$key] = $this->format_result($value);
79
-					}
80
-				}
81
-			}
82
-		}
83
-		return $result;
84
-	}
71
+    private function format_result($result) {
72
+        if (is_array($result)) {
73
+            foreach ($result as $key => $value) {
74
+                if (is_array($value)) {
75
+                    if (isset($value['attr']) && is_array($value['attr'])) {
76
+                        $result[$key] = $value['attr'];
77
+                    } else {
78
+                        $result[$key] = $this->format_result($value);
79
+                    }
80
+                }
81
+            }
82
+        }
83
+        return $result;
84
+    }
85 85
 
86 86
     private function validateID ($id) {
87 87
         if (preg_match("/^(L|P|G)?\d*$/", $id)) {
Please login to merge, or discard this patch.
bin/fetch_risk_data.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,12 +15,12 @@
 block discarded – undo
15 15
 );
16 16
 
17 17
 if ($status["@attributes"]["status"] == 1) {
18
-   print "Risk Scores for $ip:\n";
19
-   print "aggregate : " . $status["@attributes"]["riskscore.aggregate.score"] . "\n";
20
-   print "directorder : " . $status["@attributes"]["riskscore.directorder.score"] . "\n";
21
-   print "main : " . $status["@attributes"]["riskscore.main.score"] . "\n";
18
+    print "Risk Scores for $ip:\n";
19
+    print "aggregate : " . $status["@attributes"]["riskscore.aggregate.score"] . "\n";
20
+    print "directorder : " . $status["@attributes"]["riskscore.directorder.score"] . "\n";
21
+    print "main : " . $status["@attributes"]["riskscore.main.score"] . "\n";
22 22
 } else {
23
-   print "Failed to fetch risk data\n";
23
+    print "Failed to fetch risk data\n";
24 24
 }
25 25
 
26 26
 ?>
Please login to merge, or discard this patch.