@@ -302,6 +302,9 @@ |
||
| 302 | 302 | return $this->restResponse(null, 201); |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | + /** |
|
| 306 | + * @return string |
|
| 307 | + */ |
|
| 305 | 308 | private function stripAccents($string) { |
| 306 | 309 | return str_replace( |
| 307 | 310 | array('à', 'á', 'â', 'ã', 'ä', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'À', 'Á', 'Â', 'Ã', 'Ä', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ù', 'Ú', 'Û', 'Ü', 'Ý'), |
@@ -2,6 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | namespace KI\UserBundle\Controller; |
| 4 | 4 | |
| 5 | +use Exception; |
|
| 5 | 6 | use KI\CoreBundle\Controller\ResourceController; |
| 6 | 7 | use KI\UserBundle\Entity\Achievement; |
| 7 | 8 | use KI\UserBundle\Entity\User; |
@@ -13,7 +14,6 @@ discard block |
||
| 13 | 14 | use Symfony\Component\HttpFoundation\Request; |
| 14 | 15 | use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; |
| 15 | 16 | use Symfony\Component\Security\Core\Exception\AccessDeniedException; |
| 16 | -use Exception; |
|
| 17 | 17 | |
| 18 | 18 | class UsersController extends ResourceController |
| 19 | 19 | { |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | throw new BadRequestHttpException('Cet utilisateur existe déjà.'); |
| 222 | 222 | |
| 223 | 223 | // Si le login existe déjà, on ajoute une lettre du prénom |
| 224 | - $login = strtolower(str_replace(' ', '-', substr($this->stripAccents($lastName), 0, 7) . $this->stripAccents($firstName)[0])); |
|
| 224 | + $login = strtolower(str_replace(' ', '-', substr($this->stripAccents($lastName), 0, 7).$this->stripAccents($firstName)[0])); |
|
| 225 | 225 | $i = 1; |
| 226 | 226 | while (count($repo->findByUsername($login)) > 0) { |
| 227 | 227 | if (isset($firstName[$i])) |
@@ -278,9 +278,9 @@ discard block |
||
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | // On récupère le contenu du fichier |
| 281 | - $path = __DIR__ . '/../../../../web/uploads/tmp/'; |
|
| 281 | + $path = __DIR__.'/../../../../web/uploads/tmp/'; |
|
| 282 | 282 | $file->move($path, 'users.list'); |
| 283 | - $list = fopen($path . 'users.list', 'r+'); |
|
| 283 | + $list = fopen($path.'users.list', 'r+'); |
|
| 284 | 284 | if ($list === false) |
| 285 | 285 | throw new BadRequestHttpException('Erreur lors de l\'upload du fichier'); |
| 286 | 286 | |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | while (!feof($list)) { |
| 291 | 291 | // On enlève le caractère de fin de ligne |
| 292 | 292 | $line = str_replace(["\r", "\n"], ['', ''], fgets($list)); |
| 293 | - if(empty($line)) |
|
| 293 | + if (empty($line)) |
|
| 294 | 294 | continue; |
| 295 | 295 | |
| 296 | 296 | $gender = $login = $firstName = $lastName = $email = $promo = $department = $origin = null; |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | $e[] = 'Adresse mail non utilisable'; |
| 307 | 307 | |
| 308 | 308 | if (count($e) > 0) { |
| 309 | - $fails[] = $line . ' : ' . implode(', ', $e); |
|
| 309 | + $fails[] = $line.' : '.implode(', ', $e); |
|
| 310 | 310 | } else { |
| 311 | 311 | |
| 312 | 312 | /** |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | } |
| 334 | 334 | $user->setGender($gender); |
| 335 | 335 | |
| 336 | - $success[] = $firstName . ' ' . $lastName; |
|
| 336 | + $success[] = $firstName.' '.$lastName; |
|
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | 339 | |
@@ -218,8 +218,8 @@ discard block |
||
| 218 | 218 | /** |
| 219 | 219 | * Add group |
| 220 | 220 | * |
| 221 | - * @param \KI\UserBundle\Entity\User $group |
|
| 222 | - * @return Comment |
|
| 221 | + * @param Group $group |
|
| 222 | + * @return CoreUser |
|
| 223 | 223 | */ |
| 224 | 224 | public function addGroupUser(\KI\UserBundle\Entity\Group $group) |
| 225 | 225 | { |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | /** |
| 233 | 233 | * Remove group |
| 234 | 234 | * |
| 235 | - * @param \KI\UserBundle\Entity\User $group |
|
| 235 | + * @param Group $group |
|
| 236 | 236 | */ |
| 237 | 237 | public function removeGroupUser(\KI\UserBundle\Entity\Group $group) |
| 238 | 238 | { |
@@ -23,6 +23,12 @@ |
||
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | // Persiste des objets notification qui seront retrievables |
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * @param string $reason |
|
| 29 | + * @param string $title |
|
| 30 | + * @param string $message |
|
| 31 | + */ |
|
| 26 | 32 | public function notify($reason, $title, $message, $mode = 'to', $recipient = array(), $resource = '') |
| 27 | 33 | { |
| 28 | 34 | $notification = new Notification($reason, $title, $message, $mode, $resource); |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | /** |
| 36 | 36 | * Éjecte tous les utilisateurs ne respectant pas la condition |
| 37 | 37 | * @param boolean $bool |
| 38 | - * @return boolean |
|
| 38 | + * @return boolean|null |
|
| 39 | 39 | */ |
| 40 | 40 | protected function trust($bool) |
| 41 | 41 | { |
@@ -9,7 +9,6 @@ |
||
| 9 | 9 | use KI\PonthubBundle\Entity\Other; |
| 10 | 10 | use KI\PonthubBundle\Entity\Serie; |
| 11 | 11 | use KI\PonthubBundle\Entity\Software; |
| 12 | -use KI\PonthubBundle\Entity\Genre; |
|
| 13 | 12 | |
| 14 | 13 | /** |
| 15 | 14 | * Class FileHelper |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | ->setReplyTo(array($from->getEmail() => $from->getFirstName().' '.$from->getLastName())) |
| 29 | 29 | ; |
| 30 | 30 | |
| 31 | - foreach($attachments as $attachment){ |
|
| 31 | + foreach ($attachments as $attachment) { |
|
| 32 | 32 | $message->attach(Swift_Attachment::fromPath($attachment["path"])->setFilename($attachment["name"])); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | ->setReplyTo(array('[email protected]' => 'Ras\'Ponts\'ine BDE des Ponts')) |
| 51 | 51 | ; |
| 52 | 52 | |
| 53 | - foreach($attachments as $attachment){ |
|
| 53 | + foreach ($attachments as $attachment) { |
|
| 54 | 54 | $message->attach(Swift_Attachment::fromPath($attachment["path"])->setFilename($attachment["name"])); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -25,9 +25,9 @@ |
||
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | return array( |
| 28 | - 'version' => $out[1][count($out[0])-1], |
|
| 29 | - 'major' => $out[2][count($out[0])-1], |
|
| 30 | - 'minor' => $out[3][count($out[0])-1], |
|
| 28 | + 'version' => $out[1][count($out[0]) - 1], |
|
| 29 | + 'major' => $out[2][count($out[0]) - 1], |
|
| 30 | + 'minor' => $out[3][count($out[0]) - 1], |
|
| 31 | 31 | 'build' => shell_exec('git log --pretty=format:"%h" -n 1'), |
| 32 | 32 | 'date' => (int)shell_exec('git log -1 --pretty=format:%ct') |
| 33 | 33 | ); |
@@ -143,10 +143,10 @@ discard block |
||
| 143 | 143 | array_multisort($ids, SORT_ASC, $locked); |
| 144 | 144 | |
| 145 | 145 | // On renvoie pas mal de données utiles |
| 146 | - $response = Achievement::getLevel($factor * $points); |
|
| 146 | + $response = Achievement::getLevel($factor*$points); |
|
| 147 | 147 | $return = array( |
| 148 | 148 | 'number' => $response['number'], |
| 149 | - 'points' => ceil($factor * $points), |
|
| 149 | + 'points' => ceil($factor*$points), |
|
| 150 | 150 | 'current_level' => $response['current'], |
| 151 | 151 | 'next_level' => isset($response['next']) ? $response['next'] : null, |
| 152 | 152 | 'unlocked' => $unlocked, |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | if (!$notification->getRead()->contains($user) && !$notification->getRecipient()->contains($user)) |
| 300 | 300 | $return[] = $notification; |
| 301 | 301 | } else |
| 302 | - throw new \Exception('Notification : mode d\'envoi inconnu (' . $mode . ')'); |
|
| 302 | + throw new \Exception('Notification : mode d\'envoi inconnu ('.$mode.')'); |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | // On marque chaque notification récupérée comme lue |
@@ -107,7 +107,7 @@ |
||
| 107 | 107 | if (!(isset($match[1]) && isset($match[2]))) { |
| 108 | 108 | return array(); |
| 109 | 109 | } |
| 110 | - $size = $match[2] * 1000; |
|
| 110 | + $size = $match[2]*1000; |
|
| 111 | 111 | $line = str_replace($match[1], '', $line); |
| 112 | 112 | |
| 113 | 113 | // On exclut tous les fichiers de type non valide |