diff --git a/ground/controllers/JsonController.php b/ground/controllers/JsonController.php index e94c465..759d9c1 100644 --- a/ground/controllers/JsonController.php +++ b/ground/controllers/JsonController.php @@ -153,6 +153,7 @@ class JsonController extends Controller if (file_put_contents($uploaddir . $photo, file_get_contents($img))) { + PhotoLinks::addLink($photo, $img); $images[] = $photo; } } else diff --git a/ground/models/PhotoLinks.php b/ground/models/PhotoLinks.php new file mode 100644 index 0000000..ea06b81 --- /dev/null +++ b/ground/models/PhotoLinks.php @@ -0,0 +1,22 @@ +_tableName_ = 'photoLinks'; + parent::__construct($fromArray); + } + + static function model() + { + return new self(); + } + + static function addLink($photo, $url) + { + $parsedUrl = parse_url($url); + App::DB()->query('INSERT INTO photoLinks VALUES ("'.$photo.'","'.$url.'","'.$parsedUrl['host'].'") ON DUPLICATE KEY UPDATE url=url;'); + } +} + diff --git a/ground/views/point.php b/ground/views/point.php index f693a32..16f2635 100644 --- a/ground/views/point.php +++ b/ground/views/point.php @@ -77,12 +77,6 @@ isAdmin == 1): ?> [ источник: source ?> ] - -