Сохранение урла точек, добавлемых ссылкой
This commit is contained in:
parent
615390860c
commit
2a5f34f679
|
|
@ -153,6 +153,7 @@ class JsonController extends Controller
|
||||||
|
|
||||||
if (file_put_contents($uploaddir . $photo, file_get_contents($img)))
|
if (file_put_contents($uploaddir . $photo, file_get_contents($img)))
|
||||||
{
|
{
|
||||||
|
PhotoLinks::addLink($photo, $img);
|
||||||
$images[] = $photo;
|
$images[] = $photo;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class PhotoLinks extends Model
|
||||||
|
{
|
||||||
|
function __construct($fromArray = array())
|
||||||
|
{
|
||||||
|
$this->_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;');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -77,12 +77,6 @@
|
||||||
<?php if (App::$user && App::$user->isAdmin == 1): ?>
|
<?php if (App::$user && App::$user->isAdmin == 1): ?>
|
||||||
[ <span class="glyphicon glyphicon-new-window"></span> <a href="<?= $point->source ?>" target="_blank">источник: <?= $point->source ?></a> ]
|
[ <span class="glyphicon glyphicon-new-window"></span> <a href="<?= $point->source ?>" target="_blank">источник: <?= $point->source ?></a> ]
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<!-- [ <span class="glyphicon glyphicon-star"></span>
|
|
||||||
<span class="glyphicon glyphicon-star"></span>
|
|
||||||
<span class="glyphicon glyphicon-star"></span>
|
|
||||||
<span class="glyphicon glyphicon-star"></span>
|
|
||||||
<span class="glyphicon glyphicon-star-empty"></span> ] -->
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue