Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 2392 | Rev 2497 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 2392 Rev 2446
Línea 487... Línea 487...
487
            
487
            
488
            $device_uuid        = filter_var($this->params()->fromPost('device_uuid', ''), FILTER_SANITIZE_STRING);
488
            $device_uuid        = filter_var($this->params()->fromPost('device_uuid', ''), FILTER_SANITIZE_STRING);
489
            $max_date_changes   = filter_var($this->params()->fromPost('max_date_changes', ''), FILTER_SANITIZE_STRING);
489
            $max_date_changes   = filter_var($this->params()->fromPost('max_date_changes', ''), FILTER_SANITIZE_STRING);
490
            $max_ids            = filter_var($this->params()->fromPost('max_ids', 0), FILTER_SANITIZE_NUMBER_INT);
490
            $max_ids            = filter_var($this->params()->fromPost('max_ids', 0), FILTER_SANITIZE_NUMBER_INT);
491
            $is_foreground      = filter_var($this->params()->fromPost('is_foreground', 0), FILTER_SANITIZE_NUMBER_INT);
-
 
-
 
491
            $is_foreground      = filter_var($this->params()->fromPost('is_foreground', 0), FILTER_SANITIZE_NUMBER_INT);
-
 
492
            $application_id     = filter_var($this->params()->fromPost('application_id', 0), FILTER_SANITIZE_NUMBER_INT);
Línea 492... Línea 493...
492
            
493
            $variant_id         = filter_var($this->params()->fromPost('variant_id', 0), FILTER_SANITIZE_NUMBER_INT);
493
      
494
      
494
            
495
            
Línea 552... Línea 553...
552
                return new JsonModel([
553
                return new JsonModel([
553
                    'success' => false,
554
                    'success' => false,
554
                    'data' => 'ERROR_DEVICE_NOT_FOUND'
555
                    'data' => 'ERROR_DEVICE_NOT_FOUND'
555
                ]);
556
                ]);
556
            } else {
557
            } else {
-
 
558
                if ($application_id && $variant_id) {
-
 
559
                    $applicationMapper = ApplicationMapper::getInstance($this->adapter);
-
 
560
                    $application = $applicationMapper->fetchOne($application_id);
-
 
561
                    if(!$application) {
-
 
562
                        return new JsonModel([
-
 
563
                            'success' => false,
-
 
564
                            'data' => 'ERROR_APPLICATION_NOT_FOUND',
-
 
565
                        ]);
-
 
566
                    }
-
 
567
                    
-
 
568
                    if($application->status == Application::STATUS_INACTIVE) {
-
 
569
                        return new JsonModel([
-
 
570
                            'success' => false,
-
 
571
                            'data' => 'ERROR_APPLICATION_IS_INACTIVE',
-
 
572
                        ]);
-
 
573
                    }
-
 
574
                    
-
 
575
                    $applicationVariantMapper = ApplicationVariantMapper::getInstance($this->adapter);
-
 
576
                    if ($variant_id) {
-
 
577
                        $applicationVariant = $applicationVariantMapper->fetchOneByApplicationIdAndVariantId($application->id, $variant_id);
-
 
578
                        if(!$applicationVariant) {
-
 
579
                            
-
 
580
                            return new JsonModel([
-
 
581
                                'success' => false,
-
 
582
                                'data' => 'ERROR_APPLICATION_VARIANT_IS_INVALID',
-
 
583
                            ]);
-
 
584
                        }
-
 
585
                    } else {
-
 
586
                        $applicationVariant = $applicationVariantMapper->fetchOneByApplicationIdAndDefault($application->id);
-
 
587
                    }
-
 
588
                    
-
 
589
                    
-
 
590
                    $device->application_id = $application->id;
-
 
591
                    $device->variant_id = $applicationVariant->variant_id;
-
 
592
                }
-
 
593
                
-
 
594
                
557
                $device->ip = Functions::getUserIP();
595
                $device->ip = Functions::getUserIP();
558
                $deviceMapper->update($device);
596
                $deviceMapper->update($device);
559
            }
597
            }
Línea 560... Línea 598...
560
            
598