FIX - мелкая ошибка при сохранении ссылки на исходную фотку

This commit is contained in:
Krivchikov Dmitry 2016-01-07 14:41:45 +03:00
parent 2607750376
commit 6ba76ab818
1 changed files with 6 additions and 2 deletions

View File

@ -17,9 +17,13 @@ class PhotoLinks extends Model
static function addLink($photo, $url)
{
$parsedUrl = parse_url($url);
$host = isset($parsedUrl['host']) ? $parsedUrl['host'] : '';
$photoDetails = explode('_', $photo);
$pointId = (int) $photoDetails[0];
App::DB()->query('INSERT INTO photoLinks VALUES ("' . $photo . '", "' . $pointId . '","' . $url . '","' . $parsedUrl['host'] . '") ON DUPLICATE KEY UPDATE url=url;');
$pointId = isset($photoDetails[0]) ? (int) $photoDetails[0] : 0;
if ($pointId) {
App::DB()->query('INSERT INTO photoLinks VALUES ("' . $photo . '", "' . $pointId . '","' . $url . '","' . $host . '") ON DUPLICATE KEY UPDATE url=url;');
}
}
static function getCaption($photo)