Completed
Push — master ( 66eeeb...63ddad )
by mains
05:22 queued 01:50
created
php/Requests/libary/Requests/Auth/Basic.php 3 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 	 * @param array|null $args Array of user and password. Must have exactly two elements
38 38
 	 */
39 39
 	public function __construct($args = null) {
40
-		if (is_array($args)) {
41
-			if (count($args) !== 2) {
40
+		if(is_array($args)) {
41
+			if(count($args) !== 2) {
42 42
 				throw new Requests_Exception('Invalid number of arguments', 'authbasicbadargs');
43 43
 			}
44 44
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 * @see fsockopen_header
54 54
 	 * @param Requests_Hooks $hooks Hook system
55 55
 	 */
56
-	public function register(Requests_Hooks &$hooks) {
56
+	public function register(Requests_Hooks&$hooks) {
57 57
 		$hooks->register('curl.before_send', array(&$this, 'curl_before_send'));
58 58
 		$hooks->register('fsockopen.after_headers', array(&$this, 'fsockopen_header'));
59 59
 	}
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,7 +15,8 @@  discard block
 block discarded – undo
15 15
  * @package Requests
16 16
  * @subpackage Authentication
17 17
  */
18
-class Requests_Auth_Basic implements Requests_Auth {
18
+class Requests_Auth_Basic implements Requests_Auth
19
+{
19 20
 	/**
20 21
 	 * Username
21 22
 	 *
@@ -36,9 +37,12 @@  discard block
 block discarded – undo
36 37
 	 * @throws Requests_Exception On incorrect number of arguments (`authbasicbadargs`)
37 38
 	 * @param array|null $args Array of user and password. Must have exactly two elements
38 39
 	 */
39
-	public function __construct($args = null) {
40
-		if (is_array($args)) {
41
-			if (count($args) !== 2) {
40
+	public function __construct($args = null)
41
+	{
42
+		if (is_array($args))
43
+		{
44
+			if (count($args) !== 2)
45
+			{
42 46
 				throw new Requests_Exception('Invalid number of arguments', 'authbasicbadargs');
43 47
 			}
44 48
 
@@ -53,7 +57,8 @@  discard block
 block discarded – undo
53 57
 	 * @see fsockopen_header
54 58
 	 * @param Requests_Hooks $hooks Hook system
55 59
 	 */
56
-	public function register(Requests_Hooks &$hooks) {
60
+	public function register(Requests_Hooks &$hooks)
61
+	{
57 62
 		$hooks->register('curl.before_send', array(&$this, 'curl_before_send'));
58 63
 		$hooks->register('fsockopen.after_headers', array(&$this, 'fsockopen_header'));
59 64
 	}
@@ -63,7 +68,8 @@  discard block
 block discarded – undo
63 68
 	 *
64 69
 	 * @param resource $handle cURL resource
65 70
 	 */
66
-	public function curl_before_send(&$handle) {
71
+	public function curl_before_send(&$handle)
72
+	{
67 73
 		curl_setopt($handle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
68 74
 		curl_setopt($handle, CURLOPT_USERPWD, $this->getAuthString());
69 75
 	}
@@ -73,7 +79,8 @@  discard block
 block discarded – undo
73 79
 	 *
74 80
 	 * @param string $out HTTP header string
75 81
 	 */
76
-	public function fsockopen_header(&$out) {
82
+	public function fsockopen_header(&$out)
83
+	{
77 84
 		$out .= sprintf("Authorization: Basic %s\r\n", base64_encode($this->getAuthString()));
78 85
 	}
79 86
 
@@ -82,7 +89,8 @@  discard block
 block discarded – undo
82 89
 	 *
83 90
 	 * @return string
84 91
 	 */
85
-	public function getAuthString() {
92
+	public function getAuthString()
93
+	{
86 94
 		return $this->user . ':' . $this->pass;
87 95
 	}
88 96
 }
89 97
\ No newline at end of file
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
 	 * @throws Requests_Exception On incorrect number of arguments (`authbasicbadargs`)
37 37
 	 * @param array|null $args Array of user and password. Must have exactly two elements
38 38
 	 */
39
-	public function __construct($args = null) {
39
+	public function __construct($args = NULL) {
40 40
 		if (is_array($args)) {
41 41
 			if (count($args) !== 2) {
42 42
 				throw new Requests_Exception('Invalid number of arguments', 'authbasicbadargs');
Please login to merge, or discard this patch.
php/Requests/UpdateLocation.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 
4
-class UpdateLocation extends AbstractRequest {
4
+class UpdateLocation extends AbstractRequest
5
+{
5 6
 		 /**
6 7
      * @var Location
7 8
      */
Please login to merge, or discard this patch.
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -3,37 +3,37 @@
 block discarded – undo
3 3
 
4 4
 class UpdateLocation extends AbstractRequest {
5 5
 		 /**
6
-     * @var Location
7
-     */
8
-    public $location;
9
-    /**
10
-     * @return Location
11
-     */
12
-    public function getLocation()
13
-    {
14
-        return $this->location;
15
-    }
16
-    /**
17
-     * @param Location $location
18
-     */
19
-    public function setLocation($location)
20
-    {
21
-        $this->location = $location;
22
-    }
6
+		  * @var Location
7
+		  */
8
+	public $location;
9
+	/**
10
+	 * @return Location
11
+	 */
12
+	public function getLocation()
13
+	{
14
+		return $this->location;
15
+	}
16
+	/**
17
+	 * @param Location $location
18
+	 */
19
+	public function setLocation($location)
20
+	{
21
+		$this->location = $location;
22
+	}
23 23
 		
24
-    function getApiEndPoint()
25
-    {
26
-        return '/v2/users/location';
27
-    }
28
-    function getPayload()
29
-    {
30
-        return array(
24
+	function getApiEndPoint()
25
+	{
26
+		return '/v2/users/location';
27
+	}
28
+	function getPayload()
29
+	{
30
+		return array(
31 31
 					"location" => $this->getLocation()->toArray(),
32
-        );
33
-    }
34
-    function getMethod()
35
-    {
36
-        return 'PUT';
37
-    }
32
+		);
33
+	}
34
+	function getMethod()
35
+	{
36
+		return 'PUT';
37
+	}
38 38
 }
39 39
 
Please login to merge, or discard this patch.
php/jodel-web.php 3 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	$expiration_date;
27 27
 	$deviceUid;
28 28
 	
29
-	if ($result->num_rows > 0)
29
+	if($result->num_rows > 0)
30 30
 	{
31 31
 			// output data of each row
32 32
 			while($row = $result->fetch_assoc()) {
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
 	if($expiration_date <= time()) {
45 45
 		$accountCreator = new CreateUser();
46
-		$accountCreator->setAccessToken($access_token);//$accountData->getAccessToken());
46
+		$accountCreator->setAccessToken($access_token); //$accountData->getAccessToken());
47 47
 		$accountCreator->setDeviceUid($deviceUid);
48 48
 		$accountCreator->setLocation($location);
49 49
 		$data = $accountCreator->execute();
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 								WHERE device_uid='" . $device_uid . "'");
64 64
 
65 65
 		$success = TRUE;
66
-		if($result === false){
66
+		if($result === false) {
67 67
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
68 68
 				$success = FALSE;
69 69
 		}	
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
 	$result = $db->query("INSERT INTO accounts (access_token, refresh_token, token_type,
103 103
 					expires_in, expiration_date, distinct_id, device_uid)
104 104
 					VALUES ('" . $access_token . "','" . $refresh_token . "','" . $token_type .
105
-					"','" .  $expires_in . "','" . $expiration_date . "','" . $distinct_id .
105
+					"','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id .
106 106
 					"','" . $device_uid . "') ");
107 107
 
108 108
 	$success = TRUE;
109
-	if($result === false){
109
+	if($result === false) {
110 110
 			$error = db_error();
111 111
 			echo $error;
112 112
 			echo "Adding account failed: (" . $result->errno . ") " . $result->error;
Please login to merge, or discard this patch.
Braces   +15 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,7 +18,8 @@  discard block
 block discarded – undo
18 18
 
19 19
 $lastPostId = "";
20 20
 
21
-function isTokenFresh(Location $location) {
21
+function isTokenFresh(Location $location)
22
+{
22 23
 	$db = new DatabaseConnect();  
23 24
 	$result = $db->query("SELECT * FROM accounts WHERE id='1'");
24 25
 	
@@ -29,7 +30,8 @@  discard block
 block discarded – undo
29 30
 	if ($result->num_rows > 0)
30 31
 	{
31 32
 			// output data of each row
32
-			while($row = $result->fetch_assoc()) {
33
+			while($row = $result->fetch_assoc())
34
+			{
33 35
 					//$access_token = $row["access_token"];
34 36
 					$expiration_date = $row["expiration_date"];
35 37
 					$deviceUid = $row["device_uid"];
@@ -41,7 +43,8 @@  discard block
 block discarded – undo
41 43
 			echo "0 results";
42 44
 	}
43 45
 
44
-	if($expiration_date <= time()) {
46
+	if($expiration_date <= time())
47
+	{
45 48
 		$accountCreator = new CreateUser();
46 49
 		$accountCreator->setAccessToken($access_token);//$accountData->getAccessToken());
47 50
 		$accountCreator->setDeviceUid($deviceUid);
@@ -63,7 +66,8 @@  discard block
 block discarded – undo
63 66
 								WHERE device_uid='" . $device_uid . "'");
64 67
 
65 68
 		$success = TRUE;
66
-		if($result === false){
69
+		if($result === false)
70
+		{
67 71
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
68 72
 				$success = FALSE;
69 73
 		}	
@@ -85,7 +89,8 @@  discard block
 block discarded – undo
85 89
 	return $data["karma"];
86 90
 }
87 91
 
88
-function registerAccount(Location $location) {
92
+function registerAccount(Location $location)
93
+{
89 94
 	$accountCreator = new CreateUser();
90 95
 	$accountCreator->setLocation($location);
91 96
 	$data = $accountCreator->execute();
@@ -106,7 +111,8 @@  discard block
 block discarded – undo
106 111
 					"','" . $device_uid . "') ");
107 112
 
108 113
 	$success = TRUE;
109
-	if($result === false){
114
+	if($result === false)
115
+	{
110 116
 			$error = db_error();
111 117
 			echo $error;
112 118
 			echo "Adding account failed: (" . $result->errno . ") " . $result->error;
@@ -117,7 +123,7 @@  discard block
 block discarded – undo
117 123
 }
118 124
 
119 125
 function getPosts($lastPostId, $accessToken, $url)
120
-{	
126
+{
121 127
 	$accountCreator = new GetPosts();
122 128
 	$accountCreator->setLastPostId($lastPostId);
123 129
 	$accountCreator->setAccessToken($accessToken);
@@ -127,7 +133,8 @@  discard block
 block discarded – undo
127 133
 	return $data;
128 134
 }
129 135
 
130
-function createAccount() {
136
+function createAccount()
137
+{
131 138
 	$location = new Location();
132 139
 	$location->setLat(50.690399);
133 140
 	$location->setLng(10.918175);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 								WHERE device_uid='" . $device_uid . "'");
64 64
 
65 65
 		$success = TRUE;
66
-		if($result === false){
66
+		if($result === FALSE){
67 67
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
68 68
 				$success = FALSE;
69 69
 		}	
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 					"','" . $device_uid . "') ");
107 107
 
108 108
 	$success = TRUE;
109
-	if($result === false){
109
+	if($result === FALSE){
110 110
 			$error = db_error();
111 111
 			echo $error;
112 112
 			echo "Adding account failed: (" . $result->errno . ") " . $result->error;
Please login to merge, or discard this patch.
php/AccountData.php 1 patch
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -2,94 +2,94 @@
 block discarded – undo
2 2
 
3 3
 class AccountData
4 4
 {
5
-    /**
6
-     * @var string
7
-     */
8
-    public $accessToken;
9
-    /**
10
-     * @var string
11
-     */
12
-    public $expirationDate;
13
-    /**
14
-     * @var string
15
-     */
16
-    public $refreshToken;
17
-    /**
18
-     * @var string
19
-     */
20
-    public $distinctId;
21
-    /**
22
-     * @var string
23
-     */
24
-    public $deviceUid;
25
-    /**
26
-     * @return string
27
-     */
28
-    public function getAccessToken()
29
-    {
30
-        return $this->accessToken;
31
-    }
32
-    /**
33
-     * @param string $accessToken
34
-     */
35
-    public function setAccessToken(string $accessToken)
36
-    {
37
-        $this->accessToken = $accessToken;
38
-    }
39
-    /**
40
-     * @return string
41
-     */
42
-    public function getExpirationDate()
43
-    {
44
-        return $this->expirationDate;
45
-    }
46
-    /**
47
-     * @param string $expirationDate
48
-     */
49
-    public function setExpirationDate(string $expirationDate)
50
-    {
51
-        $this->expirationDate = $expirationDate;
52
-    }
53
-    /**
54
-     * @return string
55
-     */
56
-    public function getRefreshToken()
57
-    {
58
-        return $this->refreshToken;
59
-    }
60
-    /**
61
-     * @param string $refreshToken
62
-     */
63
-    public function setRefreshToken(string $refreshToken)
64
-    {
65
-        $this->refreshToken = $refreshToken;
66
-    }
67
-    /**
68
-     * @return string
69
-     */
70
-    public function getDistinctId()
71
-    {
72
-        return $this->distinctId;
73
-    }
74
-    /**
75
-     * @param string $distinctId
76
-     */
77
-    public function setDistinctId(string $distinctId)
78
-    {
79
-        $this->distinctId = $distinctId;
80
-    }
81
-    /**
82
-     * @return string
83
-     */
84
-    public function getDeviceUid()
85
-    {
86
-        return $this->deviceUid;
87
-    }
88
-    /**
89
-     * @param string $deviceUid
90
-     */
91
-    public function setDeviceUid(string $deviceUid)
92
-    {
93
-        $this->deviceUid = $deviceUid;
94
-    }
5
+	/**
6
+	 * @var string
7
+	 */
8
+	public $accessToken;
9
+	/**
10
+	 * @var string
11
+	 */
12
+	public $expirationDate;
13
+	/**
14
+	 * @var string
15
+	 */
16
+	public $refreshToken;
17
+	/**
18
+	 * @var string
19
+	 */
20
+	public $distinctId;
21
+	/**
22
+	 * @var string
23
+	 */
24
+	public $deviceUid;
25
+	/**
26
+	 * @return string
27
+	 */
28
+	public function getAccessToken()
29
+	{
30
+		return $this->accessToken;
31
+	}
32
+	/**
33
+	 * @param string $accessToken
34
+	 */
35
+	public function setAccessToken(string $accessToken)
36
+	{
37
+		$this->accessToken = $accessToken;
38
+	}
39
+	/**
40
+	 * @return string
41
+	 */
42
+	public function getExpirationDate()
43
+	{
44
+		return $this->expirationDate;
45
+	}
46
+	/**
47
+	 * @param string $expirationDate
48
+	 */
49
+	public function setExpirationDate(string $expirationDate)
50
+	{
51
+		$this->expirationDate = $expirationDate;
52
+	}
53
+	/**
54
+	 * @return string
55
+	 */
56
+	public function getRefreshToken()
57
+	{
58
+		return $this->refreshToken;
59
+	}
60
+	/**
61
+	 * @param string $refreshToken
62
+	 */
63
+	public function setRefreshToken(string $refreshToken)
64
+	{
65
+		$this->refreshToken = $refreshToken;
66
+	}
67
+	/**
68
+	 * @return string
69
+	 */
70
+	public function getDistinctId()
71
+	{
72
+		return $this->distinctId;
73
+	}
74
+	/**
75
+	 * @param string $distinctId
76
+	 */
77
+	public function setDistinctId(string $distinctId)
78
+	{
79
+		$this->distinctId = $distinctId;
80
+	}
81
+	/**
82
+	 * @return string
83
+	 */
84
+	public function getDeviceUid()
85
+	{
86
+		return $this->deviceUid;
87
+	}
88
+	/**
89
+	 * @param string $deviceUid
90
+	 */
91
+	public function setDeviceUid(string $deviceUid)
92
+	{
93
+		$this->deviceUid = $deviceUid;
94
+	}
95 95
 }
Please login to merge, or discard this patch.