public function exists($item, $type)
{
return (bool)$this->sqlite->querySingle('SELECT COUNT(*) FROM `items` WHERE `type` = ' . $type . ' AND `wareUrl` = \'' . SQLite3::escapeString($item->wareUrl) . '\' AND `item_id` = \'' . SQLite3::escapeString($item->id) . '\'');
}
<ifModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/news/(.+[^/])/(.+)$
RewriteRule ^(.*)$ /%1-%2 [R=301,L]
RewriteRule ^(\d+)-([^/]+)$ news.php?id=$1&slug=$2
RewriteRule ^category/(.*)/(.*)$ category.php?id=$1&slug=$2
RewriteRule ^source/(.*)/(.*)$ source.php?id=$1&slug=$2
#RewriteRule ^(\d+)-([^/]+)$ news.php?id=$1&slug=$2
RewriteRule ^page/(.*)/(.*)$ page.php?id=$1&slug=$2
RewriteRule ^search/(.*)$ search.php?q=$1
#ErrorDocument 404 /notfound.php
RewriteRule ^not-found$ notfound.php
RewriteRule ^rss.xml$ rss.php
RewriteRule ^sitemap-(.*).xml$ sitemap.php?id=$1
RewriteRule ^categories-sitemap.xml$ categories-sitemap.php
</ifModule>
RewriteEngine on
RewriteRule ^category/(.*)/(.*)$ category.php?id=$1&slug=$2
RewriteRule ^source/(.*)/(.*)$ source.php?id=$1&slug=$2
RewriteRule ^news/(.*)/(.*)$ news.php?id=$1&slug=$2
RewriteRule ^page/(.*)/(.*)$ page.php?id=$1&slug=$2
RewriteRule ^search/(.*)$ search.php?q=$1
RewriteRule ^not-found$ notfound.php
RewriteRule ^rss.xml$ rss.php
RewriteRule ^sitemap-(.*).xml$ sitemap.php?id=$1
RewriteRule ^categories-sitemap.xml$ categories-sitemap.php
DirectoryIndex index.php
AddDefaultCharset UTF-8
<ifModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^category/(.*)/(.*)$ category.php?id=$1&slug=$2
RewriteRule ^source/(.*)/(.*)$ source.php?id=$1&slug=$2
RewriteRule ^(\d+)-([^/]+)$ news.php?id=$1&slug=$2
RewriteRule ^page/(.*)/(.*)$ page.php?id=$1&slug=$2
RewriteRule ^search/(.*)$ search.php?q=$1
RewriteRule ^not-found$ notfound.php
RewriteRule ^rss.xml$ rss.php
RewriteRule ^sitemap-(.*).xml$ sitemap.php?id=$1
RewriteRule ^categories-sitemap.xml$ categories-sitemap.php
</ifModule>
RewriteRule ^(.*)$ /%1-%2 [R=301,L]
RewriteCond %{REQUEST_URI} ^/news/(.+[^/])/(.+)$
С x2js разобраться оказалось проще.