From 79c2a2206937da77ac1815f1dc6d7db67478eddc Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Sat, 14 May 2016 13:23:55 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=BF=D1=82=D0=B8=D0=BC=D0=B8=D0=B7?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B0=20=D1=80=D0=B0=D0=B1?= =?UTF-8?q?=D0=BE=D1=82=D0=B0=20=D1=81=20=D0=BA=D0=BE=D1=80=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B8=D0=BC=D0=B8=20=D1=83=D1=80=D0=BB=D0=B0=D0=BC=D0=B8?= =?UTF-8?q?=20-=20=D0=BD=D0=BE=D0=B2=D1=8B=D0=B5=20=D1=83=D1=80=D0=BB?= =?UTF-8?q?=D1=8B=20=D0=B2=20=D0=BD=D0=B0=D1=87=D0=B0=D0=BB=D0=B5=20=D0=B8?= =?UTF-8?q?=D1=89=D1=83=D1=82=D1=81=D1=8F=20=D0=B2=20=D0=B1=D0=B0=D0=B7?= =?UTF-8?q?=D0=B5=20=D0=B8=20=D0=B5=D1=81=D0=BB=D0=B8=20=D1=82=D0=B0=D0=BA?= =?UTF-8?q?=D0=BE=D0=B3=D0=BE=20=D1=83=D1=80=D0=BB=D0=B0=20=D0=BD=D0=B5?= =?UTF-8?q?=D1=82,=20=D1=82=D0=BE=20=D0=BE=D0=BD=20=D0=B4=D0=BE=D0=B1?= =?UTF-8?q?=D0=B0=D0=B2=D0=BB=D1=8F=D0=B5=D1=82=D1=81=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/IndexController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/controllers/IndexController.php b/controllers/IndexController.php index 4485832..01d5b24 100644 --- a/controllers/IndexController.php +++ b/controllers/IndexController.php @@ -217,7 +217,11 @@ class IndexController extends Controller } $url .= ']'; - $shortUrl = ShortUrl::addNew('https://wikipoints.ru'.$url); + $shortUrl = ShortUrl::model()->getAll(array('where' => '`url` LIKE :url', 'limit' => 1), array('url' => $url)); + + if (!$shortUrl || $shortUrl->isEmpty()) { + $shortUrl = ShortUrl::addNew($url); + } print 'https://wikipoints.ru/s/'.x62::encode($shortUrl->id); }