Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 17045 Rev 17046
Línea 297... Línea 297...
297
 
297
 
298
        $remoto = $this->getFullPathImageDefault();
298
        $remoto = $this->getFullPathImageDefault();
299
        return $this->getPresignedUrl($remoto);
299
        return $this->getPresignedUrl($remoto);
Línea -... Línea 300...
-
 
300
    }
-
 
301
 
-
 
302
    /**
-
 
303
     *
-
 
304
     * @return string
-
 
305
     */
-
 
306
    public function getFullPathImageDefault()
-
 
307
    {
-
 
308
        return $this->storagePath . DIRECTORY_SEPARATOR . 'no-image.jpg';
Línea 300... Línea 309...
300
    }
309
    }
301
 
310
 
302
 
311
 
Línea 945... Línea 954...
945
 
954
 
946
        return $interal_path;
955
        return $interal_path;
Línea 947... Línea 956...
947
    }
956
    }
948
 
957
 
949
    /**
958
    /**
950
     * 
959
     *
951
     * @param string $url
960
     * @param string $url
952
     * @return string
961
     * @return string
953
     */
962
     */
954
    public function getPresignedUrl($url)
-
 
955
    {
-
 
956
 
-
 
957
 
963
    public function getPresignedUrl($url)
Línea 958... Línea 964...
958
 
964
    {
959
        $code = hash('sha256', $url);
965
        $code = hash('sha256', $url);
960
 
966
 
961
        $storageFileMapper = \LeadersLinked\Mapper\StorageFileMapper::getInstance($this->adapter);
967
        $storageFileMapper = \LeadersLinked\Mapper\StorageFileMapper::getInstance($this->adapter);
962
        $storageFile = $storageFileMapper->fetchOneByCode($code);
968
        $storageFile = $storageFileMapper->fetchOneByCode($code);
963
        if (!$storageFile) {
969
        if (! $storageFile) {
964
            $storageFile = new \LeadersLinked\Model\StorageFile();
970
            $storageFile = new \LeadersLinked\Model\StorageFile();
Línea 965... Línea 971...
965
            $storageFile->code = $code;
971
            $storageFile->code = $code;
966
            $storageFile->path = $url;
972
            $storageFile->path = $url;
Línea 967... Línea -...
967
            $storageFile->salt = \LeadersLinked\Library\Functions::generatePassword(8);
-
 
968
 
-
 
969
 
-
 
970
 
-
 
971
            $storageFileMapper->insert($storageFile);
-
 
972
        }
-
 
973
 
-
 
974
        /*
-
 
975
        $hostname = empty($_SERVER['HTTP_ORIGIN']) ? '' : $_SERVER['HTTP_ORIGIN'];
-
 
976
        
-
 
977
        if(empty($hostname)) {
-
 
978
            
-
 
979
            $hostname = empty($_SERVER['HTTP_REFERER']) ?  '' : $_SERVER['HTTP_REFERER'];
-
 
980
            
-
 
981
            if(empty($hostname)) {
-
 
982
                $hostname = empty($_SERVER['HTTP_HOST']) ?  '' : $_SERVER['HTTP_HOST'];
-
 
983
                
-
 
984
            }
-
 
985
        }
-
 
986
        
-
 
987
        print_r($_SERVER);
-
 
988
        
-
 
989
        
-
 
990
        $hostname = trim(str_replace('http://', 'https://', $hostname));
-
 
Línea -... Línea 973...
-
 
973
            $storageFile->salt = \LeadersLinked\Library\Functions::generatePassword(8);
Línea 991... Línea 974...
991
        */
974
 
992
 
975
 
Línea 993... Línea 976...
993
 
976
 
994
 
977
            $storageFileMapper->insert($storageFile);
995
 
978
        }