@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace LoginCidadao\APIBundle\Controller; |
| 4 | 4 | |
| 5 | 5 | use FOS\RestBundle\Controller\FOSRestController; |
| 6 | -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
|
| 7 | 6 | use FOS\RestBundle\Controller\Annotations as REST; |
| 8 | 7 | use Symfony\Component\HttpFoundation\Request; |
| 9 | 8 | use LoginCidadao\CoreBundle\Entity\Country; |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | $query = $this->getDoctrine()->getRepository('LoginCidadaoCoreBundle:Country') |
| 26 | 26 | ->createQueryBuilder('cty') |
| 27 | - ->where('cty.reviewed = ' . Country::REVIEWED_OK) |
|
| 27 | + ->where('cty.reviewed = '.Country::REVIEWED_OK) |
|
| 28 | 28 | ->orderBy('cty.id', 'ASC'); |
| 29 | 29 | return $this->handleView($this->view($query->getQuery()->getResult(Query::HYDRATE_ARRAY))); |
| 30 | 30 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | { |
| 39 | 39 | $query = $this->getDoctrine()->getRepository('LoginCidadaoCoreBundle:State') |
| 40 | 40 | ->createQueryBuilder('state') |
| 41 | - ->where('state.reviewed = ' . Country::REVIEWED_OK); |
|
| 41 | + ->where('state.reviewed = '.Country::REVIEWED_OK); |
|
| 42 | 42 | $country = $request->get('country_id'); |
| 43 | 43 | if ($country) { |
| 44 | 44 | $query->join('LoginCidadaoCoreBundle:Country', 'cty', 'WITH', 'state.country = cty'); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | { |
| 59 | 59 | $query = $this->getDoctrine()->getRepository('LoginCidadaoCoreBundle:City') |
| 60 | 60 | ->createQueryBuilder('c') |
| 61 | - ->where('c.reviewed = ' . Country::REVIEWED_OK); |
|
| 61 | + ->where('c.reviewed = '.Country::REVIEWED_OK); |
|
| 62 | 62 | $country = $request->get('country_id'); |
| 63 | 63 | $state = $request->get('state_id'); |
| 64 | 64 | if ($country || $state) { |
@@ -5,11 +5,9 @@ |
||
| 5 | 5 | use FOS\RestBundle\Controller\FOSRestController; |
| 6 | 6 | use JMS\Serializer\SerializationContext; |
| 7 | 7 | use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; |
| 8 | -use LoginCidadao\CoreBundle\Entity\Person; |
|
| 9 | 8 | use LoginCidadao\CoreBundle\Entity\Authorization; |
| 10 | 9 | use LoginCidadao\CoreBundle\Model\PersonInterface; |
| 11 | 10 | use LoginCidadao\OAuthBundle\Model\ClientInterface; |
| 12 | -use LoginCidadao\OAuthBundle\Model\ClientUser; |
|
| 13 | 11 | |
| 14 | 12 | class BaseController extends FOSRestController |
| 15 | 13 | { |
@@ -33,11 +33,11 @@ |
||
| 33 | 33 | $person = $this->getUser(); |
| 34 | 34 | $serializer = $this->get('jms_serializer'); |
| 35 | 35 | return $serializer->serialize($person, 'json', |
| 36 | - SerializationContext::create()->setGroups($scope)); |
|
| 36 | + SerializationContext::create()->setGroups($scope)); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | protected function getClientScope(PersonInterface $user, |
| 40 | - ClientInterface $client = null) |
|
| 40 | + ClientInterface $client = null) |
|
| 41 | 41 | { |
| 42 | 42 | if ($client === null) { |
| 43 | 43 | $client = $this->getClient(); |
@@ -7,15 +7,11 @@ |
||
| 7 | 7 | use LoginCidadao\APIBundle\Exception\RequestTimeoutException; |
| 8 | 8 | use LoginCidadao\CoreBundle\Entity\Person; |
| 9 | 9 | use LoginCidadao\CoreBundle\Entity\Authorization; |
| 10 | -use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; |
|
| 11 | -use Symfony\Component\Security\Core\Exception\AccessDeniedException; |
|
| 12 | 10 | use Symfony\Component\HttpFoundation\Request; |
| 13 | -use Symfony\Component\HttpKernel\Exception\HttpException; |
|
| 14 | 11 | use LoginCidadao\NotificationBundle\Entity\Notification; |
| 15 | 12 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
| 16 | 13 | use Nelmio\ApiDocBundle\Annotation\ApiDoc; |
| 17 | 14 | use LoginCidadao\CoreBundle\Model\PersonInterface; |
| 18 | -use LoginCidadao\OAuthBundle\Model\ClientInterface; |
|
| 19 | 15 | use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; |
| 20 | 16 | use LoginCidadao\OAuthBundle\Model\ClientUser; |
| 21 | 17 | use LoginCidadao\APIBundle\Security\Audit\Annotation as Audit; |
@@ -173,10 +173,10 @@ |
||
| 173 | 173 | ->createQueryBuilder('a') |
| 174 | 174 | ->select('cnc, p') |
| 175 | 175 | ->join('LoginCidadaoCoreBundle:Person', 'p', 'WITH', |
| 176 | - 'a.person = p') |
|
| 176 | + 'a.person = p') |
|
| 177 | 177 | ->join('LoginCidadaoOAuthBundle:Client', 'c', 'WITH', 'a.client = c') |
| 178 | 178 | ->join('LoginCidadaoCoreBundle:ConfigNotCli', 'cnc', 'WITH', |
| 179 | - 'cnc.client = c') |
|
| 179 | + 'cnc.client = c') |
|
| 180 | 180 | ->where('c.id = '.$client->getId().' and p.id = :person_id and cnc.id = :config_id') |
| 181 | 181 | ->getQuery(); |
| 182 | 182 | $rowR = array(); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | $body = json_decode($request->getContent(), 1); |
| 169 | 169 | |
| 170 | - $chkAuth = $this->getDoctrine() |
|
| 170 | + $chkAuth = $this->getDoctrine() |
|
| 171 | 171 | ->getManager() |
| 172 | 172 | ->getRepository('LoginCidadaoCoreBundle:Authorization') |
| 173 | 173 | ->createQueryBuilder('a') |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $rowR[$idx] = array('person_id' => $row['person_id'], 'error' => 'missing authorization or configuration'); |
| 192 | 192 | continue; |
| 193 | 193 | } |
| 194 | - $not = new Notification(); |
|
| 194 | + $not = new Notification(); |
|
| 195 | 195 | $not->setPerson($res[0]); |
| 196 | 196 | $not->setConfigNotCli($res[1]) |
| 197 | 197 | ->setIcon(isset($row['icon']) && $row['icon'] ? $row['icon'] |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | ->findOneBy(array( |
| 243 | 243 | 'token' => $token->getToken() |
| 244 | 244 | )); |
| 245 | - $client = $accessToken->getClient(); |
|
| 245 | + $client = $accessToken->getClient(); |
|
| 246 | 246 | |
| 247 | 247 | $people = $this->getDoctrine()->getRepository('LoginCidadaoCoreBundle:Person'); |
| 248 | 248 | $person = $people->find($id); |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace LoginCidadao\APIBundle\Entity; |
| 4 | 4 | |
| 5 | 5 | use Doctrine\ORM\Mapping as ORM; |
| 6 | -use LoginCidadao\CoreBundle\Model\PersonInterface; |
|
| 7 | 6 | use LoginCidadao\OAuthBundle\Model\ClientInterface; |
| 8 | 7 | |
| 9 | 8 | /** |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; |
| 6 | 6 | use Symfony\Component\Console\Input\InputArgument; |
| 7 | 7 | use Symfony\Component\Console\Input\InputInterface; |
| 8 | -use Symfony\Component\Console\Input\InputOption; |
|
| 9 | 8 | use Symfony\Component\Console\Output\OutputInterface; |
| 10 | 9 | use Doctrine\ORM\EntityManager; |
| 11 | 10 | use LoginCidadao\NotificationBundle\Entity\Category; |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | private function loopInsert($dir, $fileName, $query, $prepareFunction, $debug = false) |
| 98 | 98 | { |
| 99 | 99 | $entries = 0; |
| 100 | - $file = $dir . DIRECTORY_SEPARATOR . $fileName; |
|
| 100 | + $file = $dir.DIRECTORY_SEPARATOR.$fileName; |
|
| 101 | 101 | if (($handle = fopen($file, 'r')) !== false) { |
| 102 | 102 | while (($row = fgetcsv($handle)) !== false) { |
| 103 | 103 | $data = $prepareFunction($row); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | if (!($this->getDefaultOAuthClient() instanceof Client)) { |
| 118 | 118 | $uid = $this->getContainer()->getParameter('oauth_default_client.uid'); |
| 119 | 119 | $pictureName = 'client_logo.png'; |
| 120 | - $picture = new File($dir . DIRECTORY_SEPARATOR . $pictureName); |
|
| 120 | + $picture = new File($dir.DIRECTORY_SEPARATOR.$pictureName); |
|
| 121 | 121 | $domain = $this->getContainer()->getParameter('site_domain'); |
| 122 | 122 | $url = "//$domain"; |
| 123 | 123 | $grantTypes = array( |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace LoginCidadao\CoreBundle\Controller\Admin; |
| 4 | 4 | |
| 5 | -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; |
|
| 6 | 5 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; |
| 7 | 6 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
| 8 | 7 | use Symfony\Component\Routing\Annotation\Route; |
@@ -7,7 +7,6 @@ |
||
| 7 | 7 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
| 8 | 8 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; |
| 9 | 9 | use Symfony\Component\Security\Core\Exception\AccessDeniedException; |
| 10 | -use LoginCidadao\CoreBundle\Helper\GridHelper; |
|
| 11 | 10 | use LoginCidadao\CoreBundle\Form\Type\RemoveIdCardFormType; |
| 12 | 11 | use LoginCidadao\CoreBundle\Model\PersonInterface; |
| 13 | 12 | use Doctrine\Common\Collections\Collection; |
@@ -11,7 +11,6 @@ discard block |
||
| 11 | 11 | namespace LoginCidadao\CoreBundle\Controller; |
| 12 | 12 | |
| 13 | 13 | use Symfony\Component\HttpFoundation\Request; |
| 14 | -use JMS\Serializer\SerializationContext; |
|
| 15 | 14 | use Symfony\Component\HttpFoundation\JsonResponse; |
| 16 | 15 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
| 17 | 16 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
@@ -21,7 +20,6 @@ discard block |
||
| 21 | 20 | use FOS\UserBundle\FOSUserEvents; |
| 22 | 21 | use FOS\UserBundle\Event\FilterUserResponseEvent; |
| 23 | 22 | use FOS\UserBundle\Util\TokenGenerator; |
| 24 | -use LoginCidadao\CoreBundle\Form\Type\DocFormType; |
|
| 25 | 23 | use FOS\UserBundle\Event\GetResponseUserEvent; |
| 26 | 24 | use FOS\UserBundle\Event\FormEvent; |
| 27 | 25 | use LoginCidadao\CoreBundle\EventListener\ProfileEditListner; |
@@ -29,9 +27,6 @@ discard block |
||
| 29 | 27 | use LoginCidadao\CoreBundle\Entity\IdCard; |
| 30 | 28 | use Symfony\Component\HttpFoundation\Response; |
| 31 | 29 | use Symfony\Component\Form\FormError; |
| 32 | -use LoginCidadao\BadgesBundle\BadgesEvents; |
|
| 33 | -use LoginCidadao\BadgesBundle\Event\EvaluateBadgesEvent; |
|
| 34 | -use LoginCidadao\BadgesBundle\Event\ListBadgesEvent; |
|
| 35 | 30 | use LoginCidadao\CoreBundle\Helper\GridHelper; |
| 36 | 31 | |
| 37 | 32 | class PersonController extends Controller |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | 'client' => $client, |
| 80 | 80 | 'user' => $user |
| 81 | 81 | )); |
| 82 | - $refreshTokens = $em->getRepository('LoginCidadaoOAuthBundle:RefreshToken') |
|
| 82 | + $refreshTokens = $em->getRepository('LoginCidadaoOAuthBundle:RefreshToken') |
|
| 83 | 83 | ->findBy(array( |
| 84 | 84 | 'client' => $client, |
| 85 | 85 | 'user' => $user |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | public function registrationCpfAction(Request $request) |
| 217 | 217 | { |
| 218 | 218 | $person = $this->getUser(); |
| 219 | - if (is_numeric($cpf = preg_replace('/[^0-9]/', '', |
|
| 219 | + if (is_numeric($cpf = preg_replace('/[^0-9]/', '', |
|
| 220 | 220 | $request->get('cpf'))) && strlen($cpf) == 11) { |
| 221 | 221 | $person->setCpf($cpf); |
| 222 | 222 | } |
@@ -395,8 +395,8 @@ discard block |
||
| 395 | 395 | { |
| 396 | 396 | $form = $this->createForm(new DocRgFormType()); |
| 397 | 397 | $rg = null; |
| 398 | - if (($id = $request->get('id')) || (($data = $request->get($form->getName())) |
|
| 399 | - && ($id = $data['id']))) { |
|
| 398 | + if (($id = $request->get('id')) || (($data = $request->get($form->getName())) |
|
| 399 | + && ($id = $data['id']))) { |
|
| 400 | 400 | $rg = $this->getDoctrine() |
| 401 | 401 | ->getManager() |
| 402 | 402 | ->getRepository('LoginCidadaoCoreBundle:IdCard')->findOneBy(array( |
@@ -461,11 +461,21 @@ |
||
| 461 | 461 | $n5 = ($rg[0] * 2) % 9; |
| 462 | 462 | $total = $n1 + $n2 + $n3 + $n4 + $n5 + $rg[7] + $rg[5] + $rg[3] + $rg[1]; |
| 463 | 463 | |
| 464 | - if ($rg[8] == 9) $total = $total + 9; |
|
| 465 | - if ($rg[6] == 9) $total = $total + 9; |
|
| 466 | - if ($rg[4] == 9) $total = $total + 9; |
|
| 467 | - if ($rg[2] == 9) $total = $total + 9; |
|
| 468 | - if ($rg[0] == 9) $total = $total + 9; |
|
| 464 | + if ($rg[8] == 9) { |
|
| 465 | + $total = $total + 9; |
|
| 466 | + } |
|
| 467 | + if ($rg[6] == 9) { |
|
| 468 | + $total = $total + 9; |
|
| 469 | + } |
|
| 470 | + if ($rg[4] == 9) { |
|
| 471 | + $total = $total + 9; |
|
| 472 | + } |
|
| 473 | + if ($rg[2] == 9) { |
|
| 474 | + $total = $total + 9; |
|
| 475 | + } |
|
| 476 | + if ($rg[0] == 9) { |
|
| 477 | + $total = $total + 9; |
|
| 478 | + } |
|
| 469 | 479 | |
| 470 | 480 | $resto = $total % 10; |
| 471 | 481 | |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | namespace LoginCidadao\CoreBundle\Entity; |
| 3 | 3 | |
| 4 | 4 | use Doctrine\ORM\Mapping as ORM; |
| 5 | -use LoginCidadao\OAuthBundle\Entity\Client; |
|
| 6 | 5 | use LoginCidadao\CoreBundle\Entity\Person; |
| 7 | 6 | |
| 8 | 7 | /** |