@@ -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 | { |
@@ -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 | } |
@@ -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 | { |
@@ -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 |
@@ -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 |
@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -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 |
@@ -49,7 +49,7 @@ |
||
49 | 49 | * @param int $iFlags flags |
50 | 50 | * @param int $iTimeout expiration of cache |
51 | 51 | */ |
52 | - public function get(string $sName, int &$iFlags = null, int $iTimeout = 0); |
|
52 | + public function get(string $sName, int&$iFlags = null, int $iTimeout = 0); |
|
53 | 53 | |
54 | 54 | /** |
55 | 55 | * delete a value |
@@ -174,34 +174,34 @@ |
||
174 | 174 | */ |
175 | 175 | public function send() : bool |
176 | 176 | { |
177 | - $sHeaders = 'From: ' . $this->_sFrom . "\r\n"; |
|
177 | + $sHeaders = 'From: '.$this->_sFrom."\r\n"; |
|
178 | 178 | |
179 | 179 | if (empty($this->_aAttachments)) { |
180 | 180 | |
181 | 181 | if ($this->_sFormat == "HTML") { |
182 | 182 | |
183 | - $sHeaders .= 'MIME-Version: 1.0' . "\r\n"; |
|
184 | - $sHeaders .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; |
|
183 | + $sHeaders .= 'MIME-Version: 1.0'."\r\n"; |
|
184 | + $sHeaders .= 'Content-type: text/html; charset=UTF-8'."\r\n"; |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | return mail(implode(',', $this->_aRecipient), $this->_sSubject, $this->_sMessage, $sHeaders); |
188 | 188 | } |
189 | 189 | else { |
190 | 190 | |
191 | - $sBoundary = "_" . md5(uniqid(rand())); |
|
191 | + $sBoundary = "_".md5(uniqid(rand())); |
|
192 | 192 | |
193 | 193 | $sAttached = ""; |
194 | 194 | |
195 | 195 | foreach ($this->_aAttachments as $aAttachment) { |
196 | 196 | |
197 | 197 | $sAttached_file = chunk_split(base64_encode($aAttachment["content"])); |
198 | - $sAttached = "\n\n" . "--" . $sBoundary . "\nContent-Type: application; name=\"" . $aAttachment["name"] . "\"\r\nContent-Transfer-Encoding: base64\r\nContent-Disposition: attachment; filename=\"" . $aAttachment["name"] . "\"\r\n\n" . $sAttached_file . "--" . $sBoundary . "--"; |
|
198 | + $sAttached = "\n\n"."--".$sBoundary."\nContent-Type: application; name=\"".$aAttachment["name"]."\"\r\nContent-Transfer-Encoding: base64\r\nContent-Disposition: attachment; filename=\"".$aAttachment["name"]."\"\r\n\n".$sAttached_file."--".$sBoundary."--"; |
|
199 | 199 | } |
200 | 200 | |
201 | - $sHeaders = 'From: ' . $this->_sFrom . "\r\n"; |
|
201 | + $sHeaders = 'From: '.$this->_sFrom."\r\n"; |
|
202 | 202 | $sHeaders .= "MIME-Version: 1.0\r\nContent-Type: multipart/mixed; boundary=\"$sBoundary\"\r\n"; |
203 | 203 | |
204 | - $sBody = "--" . $sBoundary . "\nContent-Type: " . ($this->_sFormat == "HTML" ? "text/html" : "text/plain") . "; charset=UTF-8\r\n\n" . $this->_sMessage . $sAttached; |
|
204 | + $sBody = "--".$sBoundary."\nContent-Type: ".($this->_sFormat == "HTML" ? "text/html" : "text/plain")."; charset=UTF-8\r\n\n".$this->_sMessage.$sAttached; |
|
205 | 205 | |
206 | 206 | return mail(implode(',', $this->_aRecipient), $this->_sSubject, $sBody, $sHeaders); |
207 | 207 | } |