@@ -59,8 +59,7 @@ |
||
59 | 59 | * if the request is ajax |
60 | 60 | * |
61 | 61 | * @access public |
62 | - * @param string $sName name of the template |
|
63 | - * @return bool |
|
62 | + * @return boolean|null |
|
64 | 63 | */ |
65 | 64 | public static function isXmlHttpRequest() |
66 | 65 | { |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function __construct() |
49 | 49 | { |
50 | - $this->cookies = function() { return new Cookies(); }; |
|
51 | - $this->files = function() { return new Files(); }; |
|
52 | - $this->headers = function() { return new Headers(); }; |
|
53 | - $this->query = function() { return new Query(); }; |
|
54 | - $this->request = function() { return new RequestPost(); }; |
|
50 | + $this->cookies = function() { return new Cookies(); }; |
|
51 | + $this->files = function() { return new Files(); }; |
|
52 | + $this->headers = function() { return new Headers(); }; |
|
53 | + $this->query = function() { return new Query(); }; |
|
54 | + $this->request = function() { return new RequestPost(); }; |
|
55 | 55 | $this->server = function() { return new Server(); }; |
56 | 56 | } |
57 | 57 | |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @access public |
122 | 122 | * @return bool |
123 | - * @deprecated don't use this method because they return a false result |
|
124 | - * delete in the version 5 |
|
125 | - * @throws \Exception |
|
123 | + * @deprecated don't use this method because they return a false result |
|
124 | + * delete in the version 5 |
|
125 | + * @throws \Exception |
|
126 | 126 | */ |
127 | 127 | public static function getPreferredLanguage() |
128 | 128 | { |
129 | - throw new \Exception("Use getLanguages() method now!"); |
|
129 | + throw new \Exception("Use getLanguages() method now!"); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -171,8 +171,8 @@ discard block |
||
171 | 171 | * @access public |
172 | 172 | * @param string $name |
173 | 173 | * @return mixed |
174 | - * @deprecated please use $this->request->get() |
|
175 | - * delete in the version 5 |
|
174 | + * @deprecated please use $this->request->get() |
|
175 | + * delete in the version 5 |
|
176 | 176 | */ |
177 | 177 | public function getPost(string $name) |
178 | 178 | { |
@@ -187,22 +187,22 @@ discard block |
||
187 | 187 | */ |
188 | 188 | public static function getPut() |
189 | 189 | { |
190 | - $aPut = array(); |
|
190 | + $aPut = array(); |
|
191 | 191 | |
192 | - $rPutResource = fopen("php://input", "r"); |
|
192 | + $rPutResource = fopen("php://input", "r"); |
|
193 | 193 | |
194 | - while ($sData = fread($rPutResource, 1024)) { |
|
194 | + while ($sData = fread($rPutResource, 1024)) { |
|
195 | 195 | |
196 | - $aSeparatePut = explode('&', $sData); |
|
196 | + $aSeparatePut = explode('&', $sData); |
|
197 | 197 | |
198 | - foreach($aSeparatePut as $sOne) { |
|
198 | + foreach($aSeparatePut as $sOne) { |
|
199 | 199 | |
200 | - $aOnePut = explode('=', $sOne); |
|
201 | - $aPut[$aOnePut[0]] = $aOnePut[1]; |
|
202 | - } |
|
203 | - } |
|
200 | + $aOnePut = explode('=', $sOne); |
|
201 | + $aPut[$aOnePut[0]] = $aOnePut[1]; |
|
202 | + } |
|
203 | + } |
|
204 | 204 | |
205 | - return $aPut; |
|
205 | + return $aPut; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
@@ -221,29 +221,29 @@ discard block |
||
221 | 221 | else if ($iCode === 404) { header('HTTP/1.1 404 Not Found'); } |
222 | 222 | } |
223 | 223 | |
224 | - /** |
|
225 | - * get http method |
|
226 | - * @return string |
|
227 | - */ |
|
228 | - public function getMethod() : string |
|
229 | - { |
|
230 | - return $this->server->get('REQUEST_METHOD'); |
|
231 | - } |
|
232 | - |
|
233 | - /** |
|
234 | - * return languages accepted by the customer |
|
235 | - * @return array |
|
236 | - */ |
|
237 | - public function getLanguages() : array |
|
238 | - { |
|
239 | - if (!self::isCliRequest()) { return explode(',', preg_replace('/^([^;]);?.*$/', '$1', $_SERVER['HTTP_ACCEPT_LANGUAGE'])); } |
|
240 | - else { return array(); } |
|
241 | - } |
|
224 | + /** |
|
225 | + * get http method |
|
226 | + * @return string |
|
227 | + */ |
|
228 | + public function getMethod() : string |
|
229 | + { |
|
230 | + return $this->server->get('REQUEST_METHOD'); |
|
231 | + } |
|
232 | + |
|
233 | + /** |
|
234 | + * return languages accepted by the customer |
|
235 | + * @return array |
|
236 | + */ |
|
237 | + public function getLanguages() : array |
|
238 | + { |
|
239 | + if (!self::isCliRequest()) { return explode(',', preg_replace('/^([^;]);?.*$/', '$1', $_SERVER['HTTP_ACCEPT_LANGUAGE'])); } |
|
240 | + else { return array(); } |
|
241 | + } |
|
242 | 242 | |
243 | 243 | /** |
244 | 244 | * get path info |
245 | 245 | * @return string |
246 | - */ |
|
246 | + */ |
|
247 | 247 | public function getPathInfo() : string |
248 | 248 | { |
249 | 249 | return $this->server->get('REQUEST_URI'); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | |
196 | 196 | $aSeparatePut = explode('&', $sData); |
197 | 197 | |
198 | - foreach($aSeparatePut as $sOne) { |
|
198 | + foreach ($aSeparatePut as $sOne) { |
|
199 | 199 | |
200 | 200 | $aOnePut = explode('=', $sOne); |
201 | 201 | $aPut[$aOnePut[0]] = $aOnePut[1]; |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | */ |
215 | 215 | public static function setStatus($iCode) |
216 | 216 | { |
217 | - if ($iCode === 200) { header('HTTP/1.1 200 Ok'); } |
|
218 | - else if ($iCode === 201) { header('HTTP/1.1 201 Created'); } |
|
219 | - else if ($iCode === 204) { header("HTTP/1.0 204 No Content"); } |
|
217 | + if ($iCode === 200) { header('HTTP/1.1 200 Ok'); } |
|
218 | + else if ($iCode === 201) { header('HTTP/1.1 201 Created'); } |
|
219 | + else if ($iCode === 204) { header("HTTP/1.0 204 No Content"); } |
|
220 | 220 | else if ($iCode === 403) { header('HTTP/1.1 403 Forbidden'); } |
221 | 221 | else if ($iCode === 404) { header('HTTP/1.1 404 Not Found'); } |
222 | 222 | } |
@@ -69,8 +69,7 @@ discard block |
||
69 | 69 | if (array_key_exists('HTTP_X_REQUESTED_WITH', $_SERVER) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { |
70 | 70 | |
71 | 71 | return true; |
72 | - } |
|
73 | - else { |
|
72 | + } else { |
|
74 | 73 | |
75 | 74 | return false; |
76 | 75 | } |
@@ -85,8 +84,7 @@ discard block |
||
85 | 84 | */ |
86 | 85 | public static function isHttpRequest() |
87 | 86 | { |
88 | - if (isset($_SERVER) && isset($_SERVER['HTTP_HOST'])) { return true; } |
|
89 | - else { return false; } |
|
87 | + if (isset($_SERVER) && isset($_SERVER['HTTP_HOST'])) { return true; } else { return false; } |
|
90 | 88 | } |
91 | 89 | |
92 | 90 | /** |
@@ -97,8 +95,7 @@ discard block |
||
97 | 95 | */ |
98 | 96 | public static function isHttpsRequest() |
99 | 97 | { |
100 | - if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') { return true; } |
|
101 | - else { return false; } |
|
98 | + if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') { return true; } else { return false; } |
|
102 | 99 | } |
103 | 100 | |
104 | 101 | /** |
@@ -111,8 +108,7 @@ discard block |
||
111 | 108 | { |
112 | 109 | $sSapiType = php_sapi_name(); |
113 | 110 | |
114 | - if (substr($sSapiType, 0, 3) == 'cgi' || defined('STDIN')) { return true; } |
|
115 | - else { return false; } |
|
111 | + if (substr($sSapiType, 0, 3) == 'cgi' || defined('STDIN')) { return true; } else { return false; } |
|
116 | 112 | } |
117 | 113 | |
118 | 114 | /** |
@@ -137,8 +133,7 @@ discard block |
||
137 | 133 | */ |
138 | 134 | public static function getParameters() |
139 | 135 | { |
140 | - if (isset($_GET)) { return $_GET; } |
|
141 | - else { return array(); } |
|
136 | + if (isset($_GET)) { return $_GET; } else { return array(); } |
|
142 | 137 | } |
143 | 138 | |
144 | 139 | /** |
@@ -149,8 +144,7 @@ discard block |
||
149 | 144 | */ |
150 | 145 | public static function getPostParameters() |
151 | 146 | { |
152 | - if (isset($_POST)) { return $_POST; } |
|
153 | - else { return array(); } |
|
147 | + if (isset($_POST)) { return $_POST; } else { return array(); } |
|
154 | 148 | } |
155 | 149 | |
156 | 150 | /** |
@@ -161,8 +155,7 @@ discard block |
||
161 | 155 | */ |
162 | 156 | public function isPost() |
163 | 157 | { |
164 | - if (isset($_POST) && count($_POST) > 0) { return true; } |
|
165 | - else { return false; } |
|
158 | + if (isset($_POST) && count($_POST) > 0) { return true; } else { return false; } |
|
166 | 159 | } |
167 | 160 | |
168 | 161 | /** |
@@ -214,11 +207,7 @@ discard block |
||
214 | 207 | */ |
215 | 208 | public static function setStatus($iCode) |
216 | 209 | { |
217 | - if ($iCode === 200) { header('HTTP/1.1 200 Ok'); } |
|
218 | - else if ($iCode === 201) { header('HTTP/1.1 201 Created'); } |
|
219 | - else if ($iCode === 204) { header("HTTP/1.0 204 No Content"); } |
|
220 | - else if ($iCode === 403) { header('HTTP/1.1 403 Forbidden'); } |
|
221 | - else if ($iCode === 404) { header('HTTP/1.1 404 Not Found'); } |
|
210 | + if ($iCode === 200) { header('HTTP/1.1 200 Ok'); } else if ($iCode === 201) { header('HTTP/1.1 201 Created'); } else if ($iCode === 204) { header("HTTP/1.0 204 No Content"); } else if ($iCode === 403) { header('HTTP/1.1 403 Forbidden'); } else if ($iCode === 404) { header('HTTP/1.1 404 Not Found'); } |
|
222 | 211 | } |
223 | 212 | |
224 | 213 | /** |
@@ -236,8 +225,7 @@ discard block |
||
236 | 225 | */ |
237 | 226 | public function getLanguages() : array |
238 | 227 | { |
239 | - if (!self::isCliRequest()) { return explode(',', preg_replace('/^([^;]);?.*$/', '$1', $_SERVER['HTTP_ACCEPT_LANGUAGE'])); } |
|
240 | - else { return array(); } |
|
228 | + if (!self::isCliRequest()) { return explode(',', preg_replace('/^([^;]);?.*$/', '$1', $_SERVER['HTTP_ACCEPT_LANGUAGE'])); } else { return array(); } |
|
241 | 229 | } |
242 | 230 | |
243 | 231 | /** |
@@ -81,7 +81,7 @@ |
||
81 | 81 | * |
82 | 82 | * @access public |
83 | 83 | * @param string $sFile |
84 | - * @return bool|object |
|
84 | + * @return null|boolean |
|
85 | 85 | */ |
86 | 86 | public function upload(string $sFile) |
87 | 87 | { |
@@ -118,10 +118,10 @@ |
||
118 | 118 | $aImageSizes = getimagesize($_FILES[$sFile]['tmp_name']); |
119 | 119 | |
120 | 120 | $fRatio = min($aImageSizes[0] / $this->_iWidth, $aImageSizes[1] / $this->_iHeight); |
121 | - $iHeight = $aImageSizes[1] / $fRatio; |
|
122 | - $iWidth = $aImageSizes[0] / $fRatio; |
|
123 | - $fY = ($iHeight - $this->_iHeight) / 2 * $fRatio; |
|
124 | - $fX = ($iWidth - $this->_iWidth) / 2 * $fRatio; |
|
121 | + $iHeight = $aImageSizes[1] / $fRatio; |
|
122 | + $iWidth = $aImageSizes[0] / $fRatio; |
|
123 | + $fY = ($iHeight - $this->_iHeight) / 2 * $fRatio; |
|
124 | + $fX = ($iWidth - $this->_iWidth) / 2 * $fRatio; |
|
125 | 125 | |
126 | 126 | $rNewImage = imagecreatefromjpeg($_FILES[$sFile]['tmp_name']); |
127 | 127 |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | $sExtension = strtolower(substr(strrchr($_FILES[$sFile]['name'], '.'), 1)); |
101 | 101 | |
102 | - if (count($this->_aAllowExtension) > 0 && !in_array($sExtension ,$this->_aAllowExtension)) { |
|
102 | + if (count($this->_aAllowExtension) > 0 && !in_array($sExtension, $this->_aAllowExtension)) { |
|
103 | 103 | |
104 | 104 | $this->_sError = "The extension is not good"; |
105 | 105 | return false; |
@@ -111,24 +111,24 @@ discard block |
||
111 | 111 | if ($this->_sExtension === null) { $this->setExtension($sExtension); } |
112 | 112 | |
113 | 113 | if ($this->_sName) { $sName = $sPath.$this->_sName.'.'.$this->_sExtension; } |
114 | - else { $sName = $sPath.md5(uniqid(rand(), true)).'.'.$this->_sExtension;} |
|
114 | + else { $sName = $sPath.md5(uniqid(rand(), true)).'.'.$this->_sExtension; } |
|
115 | 115 | |
116 | 116 | if ($this->_bProportion == true && ($this->_iWidth || $this->_iHeight)) { |
117 | 117 | |
118 | 118 | $aImageSizes = getimagesize($_FILES[$sFile]['tmp_name']); |
119 | 119 | |
120 | 120 | $fRatio = min($aImageSizes[0] / $this->_iWidth, $aImageSizes[1] / $this->_iHeight); |
121 | - $iHeight = $aImageSizes[1] / $fRatio; |
|
122 | - $iWidth = $aImageSizes[0] / $fRatio; |
|
121 | + $iHeight = $aImageSizes[1] / $fRatio; |
|
122 | + $iWidth = $aImageSizes[0] / $fRatio; |
|
123 | 123 | $fY = ($iHeight - $this->_iHeight) / 2 * $fRatio; |
124 | 124 | $fX = ($iWidth - $this->_iWidth) / 2 * $fRatio; |
125 | 125 | |
126 | 126 | $rNewImage = imagecreatefromjpeg($_FILES[$sFile]['tmp_name']); |
127 | 127 | |
128 | - $rNewImgTrueColor = imagecreatetruecolor($this->_iWidth , $this->_iHeight); |
|
129 | - imagecopyresampled($rNewImgTrueColor , $rNewImage, 0, 0, $fX, $fY, $this->_iWidth, $this->_iHeight, $iWidth * $fRatio - $fX * 2, $iHeight * $fRatio - $fY * 2); |
|
128 | + $rNewImgTrueColor = imagecreatetruecolor($this->_iWidth, $this->_iHeight); |
|
129 | + imagecopyresampled($rNewImgTrueColor, $rNewImage, 0, 0, $fX, $fY, $this->_iWidth, $this->_iHeight, $iWidth * $fRatio - $fX * 2, $iHeight * $fRatio - $fY * 2); |
|
130 | 130 | |
131 | - imagejpeg($rNewImgTrueColor , $sName, 100); |
|
131 | + imagejpeg($rNewImgTrueColor, $sName, 100); |
|
132 | 132 | } |
133 | 133 | else { |
134 | 134 |
@@ -110,8 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | if ($this->_sExtension === null) { $this->setExtension($sExtension); } |
112 | 112 | |
113 | - if ($this->_sName) { $sName = $sPath.$this->_sName.'.'.$this->_sExtension; } |
|
114 | - else { $sName = $sPath.md5(uniqid(rand(), true)).'.'.$this->_sExtension;} |
|
113 | + if ($this->_sName) { $sName = $sPath.$this->_sName.'.'.$this->_sExtension; } else { $sName = $sPath.md5(uniqid(rand(), true)).'.'.$this->_sExtension;} |
|
115 | 114 | |
116 | 115 | if ($this->_bProportion == true && ($this->_iWidth || $this->_iHeight)) { |
117 | 116 | |
@@ -129,8 +128,7 @@ discard block |
||
129 | 128 | imagecopyresampled($rNewImgTrueColor , $rNewImage, 0, 0, $fX, $fY, $this->_iWidth, $this->_iHeight, $iWidth * $fRatio - $fX * 2, $iHeight * $fRatio - $fY * 2); |
130 | 129 | |
131 | 130 | imagejpeg($rNewImgTrueColor , $sName, 100); |
132 | - } |
|
133 | - else { |
|
131 | + } else { |
|
134 | 132 | |
135 | 133 | $bResultat = move_uploaded_file($_FILES[$sFile]['tmp_name'], $sName); |
136 | 134 |
@@ -39,31 +39,31 @@ |
||
39 | 39 | * |
40 | 40 | * @access public |
41 | 41 | * @return void |
42 | - * @test |
|
42 | + * @test |
|
43 | 43 | */ |
44 | 44 | |
45 | 45 | public function testShow() |
46 | - { |
|
47 | - try { |
|
46 | + { |
|
47 | + try { |
|
48 | 48 | |
49 | - ob_start(); |
|
50 | - $exemple1 = new Exemple1; |
|
51 | - $exemple1->show(); |
|
52 | - $content = ob_get_clean(); |
|
49 | + ob_start(); |
|
50 | + $exemple1 = new Exemple1; |
|
51 | + $exemple1->show(); |
|
52 | + $content = ob_get_clean(); |
|
53 | 53 | |
54 | - //var_dump(debug_backtrace()); |
|
54 | + //var_dump(debug_backtrace()); |
|
55 | 55 | |
56 | - if ($content) { |
|
56 | + if ($content) { |
|
57 | 57 | |
58 | - $this->assertTrue(true); |
|
59 | - } |
|
60 | - else { |
|
61 | - $this->assertTrue(false); |
|
62 | - } |
|
63 | - } |
|
64 | - catch(\Exception $e) { |
|
65 | - $this->assertTrue(false); |
|
66 | - } |
|
58 | + $this->assertTrue(true); |
|
59 | + } |
|
60 | + else { |
|
61 | + $this->assertTrue(false); |
|
62 | + } |
|
63 | + } |
|
64 | + catch(\Exception $e) { |
|
65 | + $this->assertTrue(false); |
|
66 | + } |
|
67 | 67 | |
68 | 68 | } |
69 | 69 | } |
70 | 70 | \ No newline at end of file |
@@ -61,7 +61,7 @@ |
||
61 | 61 | $this->assertTrue(false); |
62 | 62 | } |
63 | 63 | } |
64 | - catch(\Exception $e) { |
|
64 | + catch (\Exception $e) { |
|
65 | 65 | $this->assertTrue(false); |
66 | 66 | } |
67 | 67 |
@@ -56,12 +56,10 @@ |
||
56 | 56 | if ($content) { |
57 | 57 | |
58 | 58 | $this->assertTrue(true); |
59 | - } |
|
60 | - else { |
|
59 | + } else { |
|
61 | 60 | $this->assertTrue(false); |
62 | 61 | } |
63 | - } |
|
64 | - catch(\Exception $e) { |
|
62 | + } catch(\Exception $e) { |
|
65 | 63 | $this->assertTrue(false); |
66 | 64 | } |
67 | 65 |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class Ldap |
32 | 32 | { |
33 | - /** |
|
34 | - * connection at ldap server |
|
35 | - * |
|
36 | - * @access private |
|
37 | - * @var resource |
|
38 | - */ |
|
33 | + /** |
|
34 | + * connection at ldap server |
|
35 | + * |
|
36 | + * @access private |
|
37 | + * @var resource |
|
38 | + */ |
|
39 | 39 | private $_rConnect; |
40 | 40 | |
41 | 41 | /** |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function __construct() |
64 | 64 | { |
65 | - $oDbConf = Config::get('Ldap')->configuration; |
|
65 | + $oDbConf = Config::get('Ldap')->configuration; |
|
66 | 66 | |
67 | 67 | $this->_sBase = $oDbConf->base; |
68 | 68 | |
@@ -77,28 +77,28 @@ discard block |
||
77 | 77 | * @access public |
78 | 78 | * @return array |
79 | 79 | */ |
80 | - public function getGroups() : array |
|
81 | - { |
|
82 | - $rSearch = ldap_search( $this->_rConnect , $this->_sBase , "objectclass=group" , array("cn") ); |
|
83 | - $aEntries = ldap_get_entries($this->_rConnect, $rSearch); |
|
84 | - $aGroups = array(); |
|
80 | + public function getGroups() : array |
|
81 | + { |
|
82 | + $rSearch = ldap_search( $this->_rConnect , $this->_sBase , "objectclass=group" , array("cn") ); |
|
83 | + $aEntries = ldap_get_entries($this->_rConnect, $rSearch); |
|
84 | + $aGroups = array(); |
|
85 | 85 | |
86 | - for ( $i = 0 ; $i < $aEntries["count"] ; $i++ ) { |
|
86 | + for ( $i = 0 ; $i < $aEntries["count"] ; $i++ ) { |
|
87 | 87 | |
88 | - $aGroups[] = utf8_encode($aEntries[$i]["dn"]); |
|
89 | - } |
|
90 | - |
|
91 | - return $aGroups; |
|
92 | - } |
|
93 | - |
|
94 | - /** |
|
95 | - * Authentification in Ldap |
|
96 | - * |
|
97 | - * @access public |
|
98 | - * @param string $sUser |
|
99 | - * @param string $sPassword |
|
100 | - * @return \Venus\lib\Ldap |
|
101 | - */ |
|
88 | + $aGroups[] = utf8_encode($aEntries[$i]["dn"]); |
|
89 | + } |
|
90 | + |
|
91 | + return $aGroups; |
|
92 | + } |
|
93 | + |
|
94 | + /** |
|
95 | + * Authentification in Ldap |
|
96 | + * |
|
97 | + * @access public |
|
98 | + * @param string $sUser |
|
99 | + * @param string $sPassword |
|
100 | + * @return \Venus\lib\Ldap |
|
101 | + */ |
|
102 | 102 | public function bind($sUser, $sPassword) : Ldap |
103 | 103 | { |
104 | 104 | return $this->_bConnected = ldap_bind($this->_rConnect, $sUser, $sPassword); |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function unbind() : bool |
115 | 115 | { |
116 | - if ($this->_bConnected) { return $this->_bConnected = ldap_unbind($this->_rConnect); } |
|
117 | - else { return true; } |
|
116 | + if ($this->_bConnected) { return $this->_bConnected = ldap_unbind($this->_rConnect); } |
|
117 | + else { return true; } |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function getGroups() : array |
81 | 81 | { |
82 | - $rSearch = ldap_search( $this->_rConnect , $this->_sBase , "objectclass=group" , array("cn") ); |
|
82 | + $rSearch = ldap_search($this->_rConnect, $this->_sBase, "objectclass=group", array("cn")); |
|
83 | 83 | $aEntries = ldap_get_entries($this->_rConnect, $rSearch); |
84 | 84 | $aGroups = array(); |
85 | 85 | |
86 | - for ( $i = 0 ; $i < $aEntries["count"] ; $i++ ) { |
|
86 | + for ($i = 0; $i < $aEntries["count"]; $i++) { |
|
87 | 87 | |
88 | 88 | $aGroups[] = utf8_encode($aEntries[$i]["dn"]); |
89 | 89 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | $aResultSet[$i] = array_intersect_key($aEntries[$i], $aMask); |
193 | 193 | |
194 | - foreach($aResultSet[$i] as &$aValues) { |
|
194 | + foreach ($aResultSet[$i] as &$aValues) { |
|
195 | 195 | |
196 | 196 | unset($aValues['count']); |
197 | 197 | } |
@@ -113,8 +113,7 @@ |
||
113 | 113 | */ |
114 | 114 | public function unbind() : bool |
115 | 115 | { |
116 | - if ($this->_bConnected) { return $this->_bConnected = ldap_unbind($this->_rConnect); } |
|
117 | - else { return true; } |
|
116 | + if ($this->_bConnected) { return $this->_bConnected = ldap_unbind($this->_rConnect); } else { return true; } |
|
118 | 117 | } |
119 | 118 | |
120 | 119 | /** |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | public function set(string $sName, $mValue, int $iExpire = 0, string $sPath = '', string $sDomain = '', int $iSecure = false) : Cookie |
40 | 40 | { |
41 | 41 | $iExpire = time() + $iExpire; |
42 | - setcookie($sName, $mValue, $iExpire, $sPath, $sDomain, $iSecure); |
|
43 | - return $this; |
|
42 | + setcookie($sName, $mValue, $iExpire, $sPath, $sDomain, $iSecure); |
|
43 | + return $this; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function get(string $sName) |
54 | 54 | { |
55 | - return $_COOKIE[$sName]; |
|
55 | + return $_COOKIE[$sName]; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -64,6 +64,6 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function exists(string $sName) : bool |
66 | 66 | { |
67 | - return isset($_COOKIE[$sName]); |
|
67 | + return isset($_COOKIE[$sName]); |
|
68 | 68 | } |
69 | 69 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | */ |
31 | 31 | interface ResponseInterface |
32 | 32 | { |
33 | - /** |
|
33 | + /** |
|
34 | 34 | * translate the content |
35 | 35 | * |
36 | 36 | * @access public |
@@ -34,61 +34,61 @@ |
||
34 | 34 | */ |
35 | 35 | private $_sLanguage = LANGUAGE; |
36 | 36 | |
37 | - /** |
|
38 | - * set the language if you don't want take the default language of the configuration file |
|
39 | - * |
|
40 | - * @access public |
|
41 | - * @param int $iImageUri |
|
42 | - * @param int $iWidth |
|
43 | - * @param int $iHeight |
|
44 | - * @param bool $bKeepDimension |
|
45 | - * @return void |
|
46 | - */ |
|
37 | + /** |
|
38 | + * set the language if you don't want take the default language of the configuration file |
|
39 | + * |
|
40 | + * @access public |
|
41 | + * @param int $iImageUri |
|
42 | + * @param int $iWidth |
|
43 | + * @param int $iHeight |
|
44 | + * @param bool $bKeepDimension |
|
45 | + * @return void |
|
46 | + */ |
|
47 | 47 | public static function showImageInSize(int $iImageUri, int $iWidth, int $iHeight, bool $bKeepDimension = false) |
48 | 48 | { |
49 | - $aSize = getimagesize($iImageUri); |
|
50 | - $rActualImage = imagecreatefromjpeg($iImageUri); |
|
49 | + $aSize = getimagesize($iImageUri); |
|
50 | + $rActualImage = imagecreatefromjpeg($iImageUri); |
|
51 | 51 | |
52 | - $ImageChoisie = imagecreatefromjpeg($_FILES['ImageNews']['tmp_name']); |
|
53 | - $TailleImageChoisie = getimagesize($_FILES['ImageNews']['tmp_name']); |
|
52 | + $ImageChoisie = imagecreatefromjpeg($_FILES['ImageNews']['tmp_name']); |
|
53 | + $TailleImageChoisie = getimagesize($_FILES['ImageNews']['tmp_name']); |
|
54 | 54 | |
55 | - $rNewImage = imagecreatetruecolor($iWidth , $iHeight); |
|
55 | + $rNewImage = imagecreatetruecolor($iWidth , $iHeight); |
|
56 | 56 | |
57 | - if ($bKeepDimension === false) { |
|
57 | + if ($bKeepDimension === false) { |
|
58 | 58 | |
59 | - imagecopyresampled($rNewImage, $rActualImage, 0, 0, 0, 0, $iWidth, $iHeight, $aSize[0], $aSize[1]); |
|
60 | - } |
|
61 | - else { |
|
59 | + imagecopyresampled($rNewImage, $rActualImage, 0, 0, 0, 0, $iWidth, $iHeight, $aSize[0], $aSize[1]); |
|
60 | + } |
|
61 | + else { |
|
62 | 62 | |
63 | - if ($aSize[0] > $aSize[1]) { |
|
63 | + if ($aSize[0] > $aSize[1]) { |
|
64 | 64 | |
65 | - $rWhite = imagecolorallocate($rNewImage, 255, 255, 255); |
|
66 | - imagefilledrectangle($rNewImage, 0, 0, $iWidth, $iHeight, $rWhite); |
|
67 | - $fCoef = $aSize[1] / $aSize[0]; |
|
68 | - $iHeight = round($iWidth * $fCoef); |
|
69 | - $iDestY = round(($iWidth - $iHeight) / 2); |
|
70 | - $iDestX = 0; |
|
71 | - } |
|
72 | - else { |
|
65 | + $rWhite = imagecolorallocate($rNewImage, 255, 255, 255); |
|
66 | + imagefilledrectangle($rNewImage, 0, 0, $iWidth, $iHeight, $rWhite); |
|
67 | + $fCoef = $aSize[1] / $aSize[0]; |
|
68 | + $iHeight = round($iWidth * $fCoef); |
|
69 | + $iDestY = round(($iWidth - $iHeight) / 2); |
|
70 | + $iDestX = 0; |
|
71 | + } |
|
72 | + else { |
|
73 | 73 | |
74 | - $rWhite = imagecolorallocate($rNewImage, 255, 255, 255); |
|
75 | - imagefilledrectangle($rNewImage, 0, 0, $iWidth, $iHeight, $rWhite); |
|
76 | - $fCoef = $aSize[0] / $aSize[1]; |
|
77 | - $iWidth = round($iHeight * $fCoef); |
|
78 | - $iDestX = round(($iHeight - $iWidth) / 2); |
|
79 | - $iDestY = 0; |
|
80 | - } |
|
74 | + $rWhite = imagecolorallocate($rNewImage, 255, 255, 255); |
|
75 | + imagefilledrectangle($rNewImage, 0, 0, $iWidth, $iHeight, $rWhite); |
|
76 | + $fCoef = $aSize[0] / $aSize[1]; |
|
77 | + $iWidth = round($iHeight * $fCoef); |
|
78 | + $iDestX = round(($iHeight - $iWidth) / 2); |
|
79 | + $iDestY = 0; |
|
80 | + } |
|
81 | 81 | |
82 | - $rWhite = imagecolorallocate($rNewImage, 255, 255, 255); |
|
83 | - imagefilledrectangle($rNewImage, 0, 0, $iWidth, $iHeight, $rWhite); |
|
84 | - imagecopyresampled($rNewImage, $rActualImage, $iDestX, $iDestY, 0, 0, $iWidth, $iHeight, $aSize[0], $aSize[1]); |
|
85 | - } |
|
82 | + $rWhite = imagecolorallocate($rNewImage, 255, 255, 255); |
|
83 | + imagefilledrectangle($rNewImage, 0, 0, $iWidth, $iHeight, $rWhite); |
|
84 | + imagecopyresampled($rNewImage, $rActualImage, $iDestX, $iDestY, 0, 0, $iWidth, $iHeight, $aSize[0], $aSize[1]); |
|
85 | + } |
|
86 | 86 | |
87 | - imagedestroy($rActualImage); |
|
88 | - $NomImageChoisie = explode('.', $rNewImage); |
|
89 | - $NomImageExploitable = time(); |
|
87 | + imagedestroy($rActualImage); |
|
88 | + $NomImageChoisie = explode('.', $rNewImage); |
|
89 | + $NomImageExploitable = time(); |
|
90 | 90 | |
91 | - header('Content-Type: image/jpeg'); |
|
92 | - imagejpeg($rNewImage , null, 100); |
|
91 | + header('Content-Type: image/jpeg'); |
|
92 | + imagejpeg($rNewImage , null, 100); |
|
93 | 93 | } |
94 | 94 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $ImageChoisie = imagecreatefromjpeg($_FILES['ImageNews']['tmp_name']); |
53 | 53 | $TailleImageChoisie = getimagesize($_FILES['ImageNews']['tmp_name']); |
54 | 54 | |
55 | - $rNewImage = imagecreatetruecolor($iWidth , $iHeight); |
|
55 | + $rNewImage = imagecreatetruecolor($iWidth, $iHeight); |
|
56 | 56 | |
57 | 57 | if ($bKeepDimension === false) { |
58 | 58 | |
@@ -89,6 +89,6 @@ discard block |
||
89 | 89 | $NomImageExploitable = time(); |
90 | 90 | |
91 | 91 | header('Content-Type: image/jpeg'); |
92 | - imagejpeg($rNewImage , null, 100); |
|
92 | + imagejpeg($rNewImage, null, 100); |
|
93 | 93 | } |
94 | 94 | } |
@@ -57,8 +57,7 @@ discard block |
||
57 | 57 | if ($bKeepDimension === false) { |
58 | 58 | |
59 | 59 | imagecopyresampled($rNewImage, $rActualImage, 0, 0, 0, 0, $iWidth, $iHeight, $aSize[0], $aSize[1]); |
60 | - } |
|
61 | - else { |
|
60 | + } else { |
|
62 | 61 | |
63 | 62 | if ($aSize[0] > $aSize[1]) { |
64 | 63 | |
@@ -68,8 +67,7 @@ discard block |
||
68 | 67 | $iHeight = round($iWidth * $fCoef); |
69 | 68 | $iDestY = round(($iWidth - $iHeight) / 2); |
70 | 69 | $iDestX = 0; |
71 | - } |
|
72 | - else { |
|
70 | + } else { |
|
73 | 71 | |
74 | 72 | $rWhite = imagecolorallocate($rNewImage, 255, 255, 255); |
75 | 73 | imagefilledrectangle($rNewImage, 0, 0, $iWidth, $iHeight, $rWhite); |
@@ -137,15 +137,15 @@ discard block |
||
137 | 137 | |
138 | 138 | if (!isset(self::$_aCache['memcache'])) { |
139 | 139 | |
140 | - $oDbConf = Config::get('Memcache')->configuration; |
|
140 | + $oDbConf = Config::get('Memcache')->configuration; |
|
141 | 141 | |
142 | - if (isset($oDbConf->port)) { $sPort = $oDbConf->port; } |
|
143 | - else { $sPort = null; } |
|
142 | + if (isset($oDbConf->port)) { $sPort = $oDbConf->port; } |
|
143 | + else { $sPort = null; } |
|
144 | 144 | |
145 | - if (isset($oDbConf->timeout)) { $iTimeout = $oDbConf->timeout; } |
|
146 | - else { $iTimeout = null; } |
|
145 | + if (isset($oDbConf->timeout)) { $iTimeout = $oDbConf->timeout; } |
|
146 | + else { $iTimeout = null; } |
|
147 | 147 | |
148 | - self::$_aCache['memcache'] = new CacheMemcache($oDbConf->host, $sPort, $iTimeout); |
|
148 | + self::$_aCache['memcache'] = new CacheMemcache($oDbConf->host, $sPort, $iTimeout); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | return self::$_aCache['memcache']; |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | |
161 | 161 | if (!isset(self::$_aCache['redis'])) { |
162 | 162 | |
163 | - $oDbConf = Config::get('Redis')->configuration; |
|
164 | - self::$_aCache['memcache'] = new Redis($oDbConf); |
|
163 | + $oDbConf = Config::get('Redis')->configuration; |
|
164 | + self::$_aCache['memcache'] = new Redis($oDbConf); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | return self::$_aCache['redis']; |
@@ -91,7 +91,7 @@ |
||
91 | 91 | * @param int $iTimeout expiration of cache |
92 | 92 | * @return bool |
93 | 93 | */ |
94 | - public static function get(string $sName, int &$iFlags = null, int $iTimeout = 0) : bool |
|
94 | + public static function get(string $sName, int&$iFlags = null, int $iTimeout = 0) : bool |
|
95 | 95 | { |
96 | 96 | return self::_getCacheObject()->get($sName, $iFlags, $iTimeout); |
97 | 97 | } |
@@ -60,11 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public static function setCacheType(string $sCacheName) |
62 | 62 | { |
63 | - if ($sCacheName === 'file') { self::$_sTypeOfCache = 'file'; } |
|
64 | - else if ($sCacheName === 'memcache') { self::$_sTypeOfCache = 'memcache'; } |
|
65 | - else if ($sCacheName === 'apc') { self::$_sTypeOfCache = 'apc'; } |
|
66 | - else if ($sCacheName === 'redis') { self::$_sTypeOfCache = 'redis'; } |
|
67 | - else { self::$_sTypeOfCache = 'mock'; } |
|
63 | + if ($sCacheName === 'file') { self::$_sTypeOfCache = 'file'; } else if ($sCacheName === 'memcache') { self::$_sTypeOfCache = 'memcache'; } else if ($sCacheName === 'apc') { self::$_sTypeOfCache = 'apc'; } else if ($sCacheName === 'redis') { self::$_sTypeOfCache = 'redis'; } else { self::$_sTypeOfCache = 'mock'; } |
|
68 | 64 | } |
69 | 65 | |
70 | 66 | /** |
@@ -132,31 +128,26 @@ discard block |
||
132 | 128 | if (!isset(self::$_aCache['file'])) { self::$_aCache['file'] = new CacheFile; } |
133 | 129 | |
134 | 130 | return self::$_aCache['file']; |
135 | - } |
|
136 | - else if (self::$_sTypeOfCache === 'memcache') { |
|
131 | + } else if (self::$_sTypeOfCache === 'memcache') { |
|
137 | 132 | |
138 | 133 | if (!isset(self::$_aCache['memcache'])) { |
139 | 134 | |
140 | 135 | $oDbConf = Config::get('Memcache')->configuration; |
141 | 136 | |
142 | - if (isset($oDbConf->port)) { $sPort = $oDbConf->port; } |
|
143 | - else { $sPort = null; } |
|
137 | + if (isset($oDbConf->port)) { $sPort = $oDbConf->port; } else { $sPort = null; } |
|
144 | 138 | |
145 | - if (isset($oDbConf->timeout)) { $iTimeout = $oDbConf->timeout; } |
|
146 | - else { $iTimeout = null; } |
|
139 | + if (isset($oDbConf->timeout)) { $iTimeout = $oDbConf->timeout; } else { $iTimeout = null; } |
|
147 | 140 | |
148 | 141 | self::$_aCache['memcache'] = new CacheMemcache($oDbConf->host, $sPort, $iTimeout); |
149 | 142 | } |
150 | 143 | |
151 | 144 | return self::$_aCache['memcache']; |
152 | - } |
|
153 | - else if (self::$_sTypeOfCache === 'apc') { |
|
145 | + } else if (self::$_sTypeOfCache === 'apc') { |
|
154 | 146 | |
155 | 147 | if (!isset(self::$_aCache['apc'])) { self::$_aCache['apc'] = new Apc; } |
156 | 148 | |
157 | 149 | return self::$_aCache['apc']; |
158 | - } |
|
159 | - else if (self::$_sTypeOfCache === 'redis') { |
|
150 | + } else if (self::$_sTypeOfCache === 'redis') { |
|
160 | 151 | |
161 | 152 | if (!isset(self::$_aCache['redis'])) { |
162 | 153 | |
@@ -165,8 +156,7 @@ discard block |
||
165 | 156 | } |
166 | 157 | |
167 | 158 | return self::$_aCache['redis']; |
168 | - } |
|
169 | - else if (self::$_sTypeOfCache === 'mock') { |
|
159 | + } else if (self::$_sTypeOfCache === 'mock') { |
|
170 | 160 | |
171 | 161 | if (!isset(self::$_aCache['mock'])) { self::$_aCache['mock'] = new Mock; } |
172 | 162 |
@@ -40,28 +40,28 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function javascripts() : array { |
42 | 42 | |
43 | - $sDefaultPath = 'http://'.$_SERVER['HTTP_HOST'].'/getJs?'; |
|
44 | - $aJavascript = func_get_args(); |
|
45 | - $aReturns = array(); |
|
43 | + $sDefaultPath = 'http://'.$_SERVER['HTTP_HOST'].'/getJs?'; |
|
44 | + $aJavascript = func_get_args(); |
|
45 | + $aReturns = array(); |
|
46 | 46 | |
47 | - foreach($aJavascript as $aJsCombination) { |
|
47 | + foreach($aJavascript as $aJsCombination) { |
|
48 | 48 | |
49 | - $sJsPath = $sDefaultPath; |
|
49 | + $sJsPath = $sDefaultPath; |
|
50 | 50 | |
51 | - foreach ($aJsCombination as $sJsToAdd) { |
|
51 | + foreach ($aJsCombination as $sJsToAdd) { |
|
52 | 52 | |
53 | - $sJsPath = $sJsToAdd.'&'; |
|
54 | - } |
|
53 | + $sJsPath = $sJsToAdd.'&'; |
|
54 | + } |
|
55 | 55 | |
56 | - if (defined('ASSET_VERSION') && ASSET_VERSION) { |
|
56 | + if (defined('ASSET_VERSION') && ASSET_VERSION) { |
|
57 | 57 | |
58 | - $sJsPath = ASSET_VERSION; |
|
59 | - } |
|
58 | + $sJsPath = ASSET_VERSION; |
|
59 | + } |
|
60 | 60 | |
61 | - $aReturns[] = $sJsPath; |
|
62 | - } |
|
61 | + $aReturns[] = $sJsPath; |
|
62 | + } |
|
63 | 63 | |
64 | - return $aReturns; |
|
64 | + return $aReturns; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -75,27 +75,27 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function stylesheets() : array { |
77 | 77 | |
78 | - $sDefaultPath = 'http://'.$_SERVER['HTTP_HOST'].'/getCss?'; |
|
79 | - $aCss = func_get_args(); |
|
80 | - $aReturns = array(); |
|
78 | + $sDefaultPath = 'http://'.$_SERVER['HTTP_HOST'].'/getCss?'; |
|
79 | + $aCss = func_get_args(); |
|
80 | + $aReturns = array(); |
|
81 | 81 | |
82 | - foreach($aCss as $aCssCombination) { |
|
82 | + foreach($aCss as $aCssCombination) { |
|
83 | 83 | |
84 | - $sCssPath = $sDefaultPath; |
|
84 | + $sCssPath = $sDefaultPath; |
|
85 | 85 | |
86 | - foreach ($aCssCombination as $sCssToAdd) { |
|
86 | + foreach ($aCssCombination as $sCssToAdd) { |
|
87 | 87 | |
88 | - $sCssPath = $sCssToAdd.'&'; |
|
89 | - } |
|
88 | + $sCssPath = $sCssToAdd.'&'; |
|
89 | + } |
|
90 | 90 | |
91 | - if (defined('ASSET_VERSION') && ASSET_VERSION) { |
|
91 | + if (defined('ASSET_VERSION') && ASSET_VERSION) { |
|
92 | 92 | |
93 | - $sJsPath = ASSET_VERSION; |
|
94 | - } |
|
93 | + $sJsPath = ASSET_VERSION; |
|
94 | + } |
|
95 | 95 | |
96 | - $aReturns[] = $sCssPath; |
|
97 | - } |
|
96 | + $aReturns[] = $sCssPath; |
|
97 | + } |
|
98 | 98 | |
99 | - return $aReturns; |
|
99 | + return $aReturns; |
|
100 | 100 | } |
101 | 101 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $aJavascript = func_get_args(); |
45 | 45 | $aReturns = array(); |
46 | 46 | |
47 | - foreach($aJavascript as $aJsCombination) { |
|
47 | + foreach ($aJavascript as $aJsCombination) { |
|
48 | 48 | |
49 | 49 | $sJsPath = $sDefaultPath; |
50 | 50 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $aCss = func_get_args(); |
80 | 80 | $aReturns = array(); |
81 | 81 | |
82 | - foreach($aCss as $aCssCombination) { |
|
82 | + foreach ($aCss as $aCssCombination) { |
|
83 | 83 | |
84 | 84 | $sCssPath = $sDefaultPath; |
85 | 85 |