Proyectos de Subversion LeadersLinked - Services

Rev

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

Rev 241 Rev 248
Línea 82... Línea 82...
82
            $response = $this->getResponse();
82
            $response = $this->getResponse();
83
            $response->setStatusCode(404);
83
            $response->setStatusCode(404);
84
            return $response;
84
            return $response;
85
        }
85
        }
Línea -... Línea 86...
-
 
86
        
-
 
87
        return new JsonModel([
86
        
88
            'success' => true,
-
 
89
            'data' => $shorter->url
Línea 87... Línea 90...
87
        return $this->redirect()->toUrl($shorter->url);
90
        ]);
Línea 88... Línea 91...
88
        
91
        
89
    }
92
    }
Línea 160... Línea 163...
160
                    'password' => $password,
163
                    'password' => $password,
161
                ];
164
                ];
162
            }
165
            }
Línea 163... Línea -...
163
                
-
 
164
            
166
                
165
            $hostname = empty($_SERVER['HTTP_HOST']) ?  '' : $_SERVER['HTTP_HOST'];
-
 
166
            
-
 
Línea 167... Línea -...
167
            $networkMapper = NetworkMapper::getInstance($this->adapter);
-
 
168
            $network = $networkMapper->fetchOneByHostnameForFrontend($hostname);
-
 
169
            
-
 
170
            if(!$network) {
-
 
171
                $network = $networkMapper->fetchOneByDefault();
167
            
Línea 172... Línea 168...
172
                
168
          
173
            }
169
            
Línea 189... Línea 185...
189
            
185
            
Línea 190... Línea 186...
190
            $shorter = $shorterMapper->fetchOne($shorter->id);
186
            $shorter = $shorterMapper->fetchOne($shorter->id);
Línea 191... Línea 187...
191
            
187
            
Línea 192... Línea 188...
192
        }
188
        }
Línea 193... Línea 189...
193
        
189
        
194
        $url = $shorter->url;
190
        $url = $this->url()->fromRoute('shorter', ['code' => $shorter->uuid]);
Línea 201... Línea 197...
201
        if(!$network) {
197
        if(!$network) {
202
            $network = $networkMapper->fetchOneByDefault();
198
            $network = $networkMapper->fetchOneByDefault();
203
        }
199
        }
Línea 204... Línea 200...
204
        
200
        
205
        $hostname = trim($network->main_hostname);
-
 
206
        $url = trim(str_replace('https://', '', $url));
-
 
207
        
-
 
208
        $pos = strpos($url, '/');
-
 
209
        $hostname2 = trim(substr($url, 0, $pos));
-
 
210
        if($hostname != $hostname2) {
-
 
211
            
201
        $hostname = trim($network->main_hostname);
212
            $url =  'https://' . $hostname . substr($url, $pos);
-
 
213
            $shorter->url = $url; 
-
 
214
            $shorterMapper->update($shorter);
202
        $url = 'https://' . $hostname . $url;
215
            
-
 
216
        } 
203
    
217
        
204
 
218
        return new JsonModel([
205
        return new JsonModel([
219
            'success' => true, 
206
            'success' => true, 
220
            'data' => $shorter->url
207
            'data' => $url
221
        ]);
208
        ]);
-
 
209
    }
-
 
210
    
Línea 222... Línea 211...
222
    }
211