From 2a5f34f67917737884d2e6f0b8baaacf9c5fe735 Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Sat, 30 May 2015 16:35:04 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=83=D1=80=D0=BB=D0=B0=20=D1=82=D0=BE?= =?UTF-8?q?=D1=87=D0=B5=D0=BA,=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BC=D1=8B=D1=85=20=D1=81=D1=81=D1=8B=D0=BB=D0=BA=D0=BE?= =?UTF-8?q?=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ground/controllers/JsonController.php | 1 + ground/models/PhotoLinks.php | 22 ++++++++++++++++++++++ ground/views/point.php | 6 ------ 3 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 ground/models/PhotoLinks.php 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 ?> ] - -