Proyectos de Subversion LeadersLinked - Services

Rev

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

Rev 257 Rev 266
Línea 48... Línea 48...
48
use LeadersLinked\Mapper\JwtTokenMapper;
48
use LeadersLinked\Mapper\JwtTokenMapper;
49
use Firebase\JWT\JWT;
49
use Firebase\JWT\JWT;
50
use Firebase\JWT\Key;
50
use Firebase\JWT\Key;
51
use LeadersLinked\Form\Auth\SigninDebugForm;
51
use LeadersLinked\Form\Auth\SigninDebugForm;
52
use LeadersLinked\Library\ExternalCredentials;
52
use LeadersLinked\Library\ExternalCredentials;
-
 
53
use LeadersLinked\Library\Storage;
Línea 53... Línea 54...
53
 
54
 
54
 
55
 
Línea 379... Línea 380...
379
                        $data['xmpp_domain'] = $currentNetwork->xmpp_domain;
380
                        $data['xmpp_domain'] = $currentNetwork->xmpp_domain;
380
                        $data['xmpp_hostname'] = $currentNetwork->xmpp_hostname;
381
                        $data['xmpp_hostname'] = $currentNetwork->xmpp_hostname;
381
                        $data['xmpp_port'] = $currentNetwork->xmpp_port;
382
                        $data['xmpp_port'] = $currentNetwork->xmpp_port;
382
                        $data['xmpp_username'] = $externalCredentials->getUsernameXmpp();
383
                        $data['xmpp_username'] = $externalCredentials->getUsernameXmpp();
383
                        $data['xmpp_pasword'] = $externalCredentials->getPasswordXmpp();
384
                        $data['xmpp_pasword'] = $externalCredentials->getPasswordXmpp();
-
 
385
                        $data['inmail_username'] = $externalCredentials->getUsernameInmail();
384
                    }
386
                        $data['inmail_pasword'] = $externalCredentials->getPasswordInmail();
-
 
387
                    
-
 
388
     $data['inmail_username']    = $externalCredentials->getUsernameInmail();
-
 
389
                        $data['inmail_password']    = $externalCredentials->getPasswordInmail();
-
 
390
 
-
 
391
			}
Línea 385... Línea 392...
385
                    
392
                    
386
                    $data = [
393
                    $data = [
387
                        'success'   => true,
394
                        'success'   => true,
388
                        'data'      => $data
395
                        'data'      => $data
Línea 574... Línea 581...
574
                $replace_main = false;
581
                $replace_main = false;
575
            } else {
582
            } else {
576
                $replace_main = true;
583
                $replace_main = true;
577
            }
584
            }
Línea -... Línea 585...
-
 
585
            
-
 
586
            $storage = Storage::getInstance($this->config);
Línea 578... Línea -...
578
            
-
 
579
            
-
 
580
            
587
            $path = $storage->getPathNetwork();
581
            $logo_url = $this->url()->fromRoute('storage-network', ['type' => 'logo'],['force_canonical' => true]);
588
            
582
            if($replace_main) {
589
            if($currentNetwork->logo) {
583
                $logo_url = str_replace($currentNetwork->main_hostname, $currentNetwork->service_hostname, $logo_url);
-
 
584
            }
-
 
585
            
-
 
586
            
-
 
587
            
590
                $logo_url = $storage->getGenericImage($path, $currentNetwork->uuid, $currentNetwork->logo);
588
            
-
 
589
            if($currentNetwork->alternative_hostname) {
-
 
590
                $logo_url = str_replace($currentNetwork->alternative_hostname, $currentNetwork->service_hostname, $logo_url);
591
            } else {
Línea 591... Línea -...
591
                
-
 
592
            }
-
 
593
            
592
                $logo_url = '';
594
            
593
            }
595
            $navbar_url = $this->url()->fromRoute('storage-network', ['type' => 'navbar'],['force_canonical' => true]);
594
            
596
            if($replace_main) {
595
            if($currentNetwork->navbar) {
597
                $navbar_url = str_replace($currentNetwork->main_hostname, $currentNetwork->service_hostname, $navbar_url);
-
 
598
            }
-
 
599
            if($currentNetwork->alternative_hostname) {
596
                $navbar_url = $storage->getGenericImage($path, $currentNetwork->uuid, $currentNetwork->navbar);
Línea 600... Línea -...
600
                $navbar_url = str_replace($currentNetwork->alternative_hostname, $currentNetwork->service_hostname, $navbar_url);
-
 
601
                
-
 
602
            }
597
            } else {
603
            
598
                $navbar_url = '';
604
            
599
            }
605
            $favico_url= $this->url()->fromRoute('storage-network', ['type' => 'favico'],['force_canonical' => true]);
600
            
606
            if($replace_main) {
-
 
607
                $favico_url = str_replace($currentNetwork->main_hostname, $currentNetwork->service_hostname, $favico_url);
-
 
608
            }
601
            if($currentNetwork->favico) {
609
            if($currentNetwork->alternative_hostname) {
-
 
Línea -... Línea 602...
-
 
602
                $favico_url = $storage->getGenericImage($path, $currentNetwork->uuid, $currentNetwork->favico);
Línea 610... Línea 603...
610
                $favico_url = str_replace($currentNetwork->alternative_hostname, $currentNetwork->service_hostname, $favico_url);
603
            } else {
611
                
604
                $favico_url = '';
612
            }
605
            }
613
            
606
 
Línea 647... Línea 640...
647
                        $data['xmpp_domain']      = $currentNetwork->xmpp_domain;
640
                        $data['xmpp_domain']      = $currentNetwork->xmpp_domain;
648
                        $data['xmpp_hostname']    = $currentNetwork->xmpp_hostname;
641
                        $data['xmpp_hostname']    = $currentNetwork->xmpp_hostname;
649
                        $data['xmpp_port']        = $currentNetwork->xmpp_port;
642
                        $data['xmpp_port']        = $currentNetwork->xmpp_port;
650
                        $data['xmpp_username']    = $externalCredentials->getUsernameXmpp();
643
                        $data['xmpp_username']    = $externalCredentials->getUsernameXmpp();
651
                        $data['xmpp_password']    = $externalCredentials->getPasswordXmpp();
644
                        $data['xmpp_password']    = $externalCredentials->getPasswordXmpp();
-
 
645
                        $data['inmail_username']    = $externalCredentials->getUsernameInmail();
-
 
646
                        $data['inmail_password']    = $externalCredentials->getPasswordInmail();
652
                    }
647
                    }
653
                }
648
                }
654
            }
649
            }
Línea 655... Línea 650...
655
            
650
            
Línea 1743... Línea 1738...
1743
 
1738
 
1744
                    if ($userMapper->insert($user)) {
1739
                    if ($userMapper->insert($user)) {
1745
                        echo json_encode(['success' => false, 'data' => $userMapper->getError()]);
1740
                        echo json_encode(['success' => false, 'data' => $userMapper->getError()]);
1746
                        exit;
1741
                        exit;
-
 
1742
                    }
-
 
1743
                    
Línea 1747... Línea 1744...
1747
                    }
1744
                    $user = $userMapper->fetchOne($user->id);
1748
 
1745
 
Línea 1749... Línea 1746...
1749
 
1746
 
1750
 
1747
 
1751
 
1748
 
-
 
1749
                    $filename   = trim(isset($data['avatar_filename']) ? filter_var($data['avatar_filename'], FILTER_SANITIZE_EMAIL) : '');
-
 
1750
                    $content    = isset($data['avatar_content']) ? Functions::sanitizeFilterString($data['avatar_content']) : '';
1752
                    $filename   = trim(isset($data['avatar_filename']) ? filter_var($data['avatar_filename'], FILTER_SANITIZE_EMAIL) : '');
1751
 
1753
                    $content    = isset($data['avatar_content']) ? Functions::sanitizeFilterString($data['avatar_content']) : '';
1752
                    if ($filename && $content) {
1754
 
-
 
1755
                    if ($filename && $content) {
1753
                        $source = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $filename;
Línea 1756... Línea 1754...
1756
                        $source = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $filename;
1754
                        try {
1757
                        try {
1755
                            
Línea -... Línea 1756...
-
 
1756
                            
-
 
1757
                            file_put_contents($source, base64_decode($content));
-
 
1758
                            if (file_exists($source)) {
-
 
1759
                                list($target_width, $target_height) = explode('x', $this->config['leaderslinked.image_sizes.user_size']);
-
 
1760
 
1758
                            file_put_contents($source, base64_decode($content));
1761
                                $target_filename    = 'user-' . uniqid() . '.png';
1759
                            if (file_exists($source)) {
1762
                                $crop_to_dimensions = true;
1760
                                $target_path = $this->config['leaderslinked.fullpath.user'] . $user->uuid;
1763
 
1761
                                list($target_width, $target_height) = explode('x', $this->config['leaderslinked.image_sizes.user_size']);
1764
                                $image = Image::getInstance($this->config);
1762
 
1765
                                $target_path    = $image->getStorage()->getPathUser();
1763
                                $target_filename    = 'user-' . uniqid() . '.png';
1766
                                $unlink_source  = true;