Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 15542 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 15542 Rev 16766
Línea 2... Línea 2...
2
declare(strict_types=1);
2
declare(strict_types=1);
Línea 3... Línea 3...
3
 
3
 
Línea 4... Línea 4...
4
namespace LeadersLinked\Controller;
4
namespace LeadersLinked\Controller;
5
 
5
 
6
use Laminas\Db\Adapter\AdapterInterface;
6
use Laminas\Db\Adapter\AdapterInterface;
7
use Laminas\Cache\Storage\Adapter\AbstractAdapter;
7
use LeadersLinked\Cache\CacheInterface;
8
use Laminas\Mvc\Controller\AbstractActionController;
8
use Laminas\Mvc\Controller\AbstractActionController;
Línea 9... Línea 9...
9
use Laminas\Log\LoggerInterface;
9
use Laminas\Log\LoggerInterface;
Línea 28... Línea 28...
28
    private $adapter;
28
    private $adapter;
Línea 29... Línea 29...
29
    
29
    
30
    
30
    
31
    /**
31
    /**
32
     *
32
     *
33
     * @var AbstractAdapter
33
     * @var CacheInterface
Línea 34... Línea 34...
34
     */
34
     */
35
    private $cache;
35
    private $cache;
Línea 48... Línea 48...
48
    private $config;
48
    private $config;
Línea 49... Línea 49...
49
    
49
    
50
    /**
50
    /**
51
     *
51
     *
52
     * @param AdapterInterface $adapter
52
     * @param AdapterInterface $adapter
53
     * @param AbstractAdapter $cache
53
     *@param CacheInterface $cache
54
     * @param LoggerInterface $logger
54
     * @param LoggerInterface $logger
55
     * @param array $config
55
     * @param array $config
56
     */
56
     */
57
    public function __construct($adapter, $cache , $logger, $config)
57
    public function __construct($adapter, $cache , $logger, $config)
Línea 174... Línea 174...
174
            } else {
174
            } else {
175
                $request_fullpath = $path . $code . DIRECTORY_SEPARATOR. $code2. DIRECTORY_SEPARATOR . $fileName;
175
                $request_fullpath = $path . $code . DIRECTORY_SEPARATOR. $code2. DIRECTORY_SEPARATOR . $fileName;
176
            }
176
            }
Línea -... Línea 177...
-
 
177
            
-
 
178
            
-
 
179
           // echo $request_fullpath; exit;
177
            
180
            
178
            
181
            
179
        } else {
182
        } else {
Línea 180... Línea 183...
180
            $request_fullpath = $no_image;
183
            $request_fullpath = $no_image;
Línea 187... Línea 190...
187
                $request_fullpath =  $no_image;
190
                $request_fullpath =  $no_image;
188
            }
191
            }
189
        }
192
        }
Línea 190... Línea -...
190
        
-
 
191
 
193
        
Línea 192... Línea 194...
192
        //echo $request_fullpath; exit;
194
 
Línea 193... Línea 195...
193
        
195
 
194
       
196
       
195
        
197
        
196
        if(file_exists($request_fullpath)) {
198
        if(file_exists($request_fullpath)) {
-
 
199
            
-
 
200
            // Try to open file
-
 
201
            if (!is_readable($request_fullpath)) {
Línea 197... Línea 202...
197
            
202
                return $this->getResponse()->setStatusCode(500);
198
            // Try to open file
203
            }
Línea 199... Línea 204...
199
            if (!is_readable($request_fullpath)) {
204
        } else {
Línea 216... Línea 221...
216
            $headers->addHeaderLine('Content-type: ' . $mimeType);
221
            $headers->addHeaderLine('Content-type: ' . $mimeType);
217
            $headers->addHeaderLine('Content-length: ' . $fileSize);
222
            $headers->addHeaderLine('Content-length: ' . $fileSize);
Línea 218... Línea 223...
218
            
223
            
219
            if($fileContent!==false) {
224
            if($fileContent!==false) {
-
 
225
                $response->setContent($fileContent);
220
                $response->setContent($fileContent);
226
                return $this->getResponse();
221
            } else {
227
            } else {
222
                $this->getResponse()->setStatusCode(500);
228
                $this->getResponse()->setStatusCode(500);
223
                return;
229
                return;
224
            }
-
 
225
        } else {
-
 
226
            return $this->getResponse()->setStatusCode(404);
230
            }
Línea 227... Línea -...
227
        }
-
 
-
 
231
       
228
 
232
 
Línea 229... Línea 233...
229
        return $this->getResponse();
233