diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ba84827
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,246 @@
+# Redactors
+/.idea/
+
+
+# Installed DLE
+/engine/cache/*.tmp
+/engine/cache/system/*.php
+/engine/data/*.txt
+/engine/data/*.php
+
+# DLE 11.1 sources
+/.htaccess
+/admin.php
+/backup/.htaccess
+/backup/index.html
+/cron.php
+/engine/ajax/addcomments.php
+/engine/ajax/adminfunction.php
+/engine/ajax/allvotes.php
+/engine/ajax/antivirus.php
+/engine/ajax/bbcode.php
+/engine/ajax/calendar.php
+/engine/ajax/clean.php
+/engine/ajax/comments.php
+/engine/ajax/complaint.php
+/engine/ajax/deletecomments.php
+/engine/ajax/editcomments.php
+/engine/ajax/editnews.php
+/engine/ajax/favorites.php
+/engine/ajax/feedback.php
+/engine/ajax/find_relates.php
+/engine/ajax/find_tags.php
+/engine/ajax/keywords.php
+/engine/ajax/message.php
+/engine/ajax/newsletter.php
+/engine/ajax/pm.php
+/engine/ajax/poll.php
+/engine/ajax/profile.php
+/engine/ajax/quote.php
+/engine/ajax/rating.php
+/engine/ajax/ratingcomments.php
+/engine/ajax/rebuild.php
+/engine/ajax/registration.php
+/engine/ajax/replycomments.php
+/engine/ajax/rss.php
+/engine/ajax/search.php
+/engine/ajax/sitemap.php
+/engine/ajax/templates.php
+/engine/ajax/typograf.php
+/engine/ajax/updates.php
+/engine/ajax/upload.php
+/engine/ajax/vote.php
+/engine/api/
+/engine/cache/*
+/engine/cache/system/*
+/engine/classes/.htaccess
+/engine/classes/antivirus.class.php
+/engine/classes/calendar/calendar.css
+/engine/classes/calendar/calendar.js
+/engine/classes/comments.class.php
+/engine/classes/download.class.php
+/engine/classes/flashplayer/*
+/engine/classes/google.class.php
+/engine/classes/highlight/
+/engine/classes/highslide/
+/engine/classes/html5player/*
+/engine/classes/js/*
+/engine/classes/mail.class.php
+/engine/classes/mail/class.phpmailer.php
+/engine/classes/masha/*
+/engine/classes/min/*
+/engine/classes/mobiledetect.class.php
+/engine/classes/mysql.php
+/engine/classes/parse.class.php
+/engine/classes/recaptcha.php
+/engine/classes/rss.class.php
+/engine/classes/social.class.php
+/engine/classes/stopspam.class.php
+/engine/classes/templates.class.php
+/engine/classes/thumb.class.php
+/engine/classes/typograf.class.php
+/engine/classes/uploads/*
+/engine/data/.htaccess
+/engine/data/emoticons/*
+/engine/download.php
+/engine/editor/*
+/engine/engine.php
+/engine/go.php
+/engine/inc/.htaccess
+/engine/inc/addnews.php
+/engine/inc/banners.php
+/engine/inc/blockip.php
+/engine/inc/categories.php
+/engine/inc/check.php
+/engine/inc/clean.php
+/engine/inc/cmoderation.php
+/engine/inc/comments.php
+/engine/inc/complaint.php
+/engine/inc/dboption.php
+/engine/inc/dumper.php
+/engine/inc/editnews.php
+/engine/inc/editusers.php
+/engine/inc/editvote.php
+/engine/inc/email.php
+/engine/inc/files.php
+/engine/inc/googlemap.php
+/engine/inc/help.php
+/engine/inc/include/.htaccess
+/engine/inc/include/functions.inc.php
+/engine/inc/include/init.php
+/engine/inc/include/inserttag.php
+/engine/inc/iptools.php
+/engine/inc/links.php
+/engine/inc/logs.php
+/engine/inc/main.php
+/engine/inc/mass_static_actions.php
+/engine/inc/mass_user_actions.php
+/engine/inc/massactions.php
+/engine/inc/newsletter.php
+/engine/inc/options.php
+/engine/inc/preview.php
+/engine/inc/question.php
+/engine/inc/rebuild.php
+/engine/inc/rss.php
+/engine/inc/rssinform.php
+/engine/inc/search.php
+/engine/inc/social.php
+/engine/inc/static.php
+/engine/inc/tagscloud.php
+/engine/inc/templates.php
+/engine/inc/userfields.php
+/engine/inc/usergroup.php
+/engine/inc/videoconfig.php
+/engine/inc/wordfilter.php
+/engine/inc/xfields.php
+/engine/init.php
+/engine/modules/.htaccess
+/engine/modules/addcomments.php
+/engine/modules/addnews.php
+/engine/modules/antibot/*
+/engine/modules/banned.php
+/engine/modules/banners.php
+/engine/modules/bbcode.php
+/engine/modules/calendar.php
+/engine/modules/changemail.php
+/engine/modules/comments.php
+/engine/modules/cron.php
+/engine/modules/deletenews.php
+/engine/modules/favorites.php
+/engine/modules/feedback.php
+/engine/modules/functions.php
+/engine/modules/lastcomments.php
+/engine/modules/links.php
+/engine/modules/lostpassword.php
+/engine/modules/main.php
+/engine/modules/offline.php
+/engine/modules/pm.php
+/engine/modules/pm_alert.php
+/engine/modules/poll.php
+/engine/modules/profile.php
+/engine/modules/register.php
+/engine/modules/rssinform.php
+/engine/modules/search.php
+/engine/modules/show.custom.php
+/engine/modules/show.full.php
+/engine/modules/show.short.php
+/engine/modules/sitelogin.php
+/engine/modules/social.php
+/engine/modules/static.php
+/engine/modules/stats.php
+/engine/modules/tagscloud.php
+/engine/modules/topnews.php
+/engine/modules/vote.php
+/engine/opensearch.php
+/engine/preview.php
+/engine/print.php
+/engine/rss.php
+/engine/skins/.htaccess
+/engine/skins/codemirror/css/default.css
+/engine/skins/codemirror/js/LICENSE
+/engine/skins/codemirror/js/code.js
+/engine/skins/default.skin.php
+/engine/skins/fonts/*
+/engine/skins/images/*
+/engine/skins/javascripts/application.js
+/engine/skins/stylesheets/application.css
+/engine/skins/stylesheets/frame.css
+/index.php
+/install.php
+/language/.htaccess
+/language/Russian/admincheck.lng
+/language/Russian/adminlogs.lng
+/language/Russian/adminpanel.lng
+/language/Russian/help.lng
+/language/Russian/website.lng
+/robots.txt
+/templates/.htaccess
+/templates/Default/*
+/templates/Gemini/*
+/templates/Green/*
+/templates/Pisces/*
+/templates/Red/*
+/templates/banned.tpl
+/templates/opensearch.tpl
+/templates/rss.tpl
+/templates/smartphone/*
+/upgrade/*
+/uploads/*
+
+# DLE 11.3 sources
+/engine/ajax/commentssubscribe.php
+/engine/ajax/twofactor.php
+/engine/classes/htmlpurifier/*
+/engine/classes/memcache.class.php
+/engine/inc/lostpassword.php
+/engine/inc/redirects.php
+/engine/inc/twofactor.php
+
+# DLE 12 sources
+/engine/inc/metatags.php
+/language/English/admincheck.lng
+/language/English/adminlogs.lng
+/language/English/adminpanel.lng
+/language/English/help.lng
+/language/English/website.lng
+
+# DLE 13 sources
+/engine/ajax/controller.php
+/engine/ajax/plugins.php
+/engine/classes/plugins.class.php
+/engine/classes/zipextract.class.php
+/engine/inc/plugins.php
+/engine/inc/upgrade.php
+/engine/inc/upgrade
+
+# DLE 14 sources
+/engine/classes/tinify/
+
+# YandexMaps
+!/engine/skins/images/ymaps.png
+!/CHANGELOG.md
+!/engine/data/ymaps_icons.json
+!/engine/data/ymaps_config.json
+!/engine/inc/ymaps.php
+!/engine/modules/ymaps/
+!/templates/{THEME}/
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f942099..9f839c8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,19 @@
-##v2.0.1 от 16.10.2018
+## 3.0.0
+- Установка в виде плагина.
+- Теперь изменения в модуль можно делать самостоятельно через систему плагинов.
+- Прекращена поддержка старых версий DLE (ниже, чем версии 13.x).
+- Убрана Украинская локализация т.к. Яндекс заблокирован на территории Украины.
+- Убрана Английская локализация т.к. никто не пользуется этой версией.
+- Обновлена поддержка тегов `[image-X]{image-X}[/image-X]`.
+- Обновлена поддержка тегов `[fullimage-X]{fullimage-X}[/fullimage-X]`.
+- Добавлена поддержка тегов `[not-image-X]...[/not-image-X]`.
+- Добавлена поддержка тегов `[not-fullimage-X]...[/not-fullimage-X]`.
+- Добавлено поле для указания apiKey для использования функций геокодинга на карте (поиск, определение позиции пользователя) (fixed #12).
+- Исправлено некорректное отображение кнопок в админке DLE 13.X (fixed #10).
+- Исправлена некорректная работа JS во время манипуляций с картой при добавлении новости (fixed #8).
+
+## 2.0.1 от 16.10.2018
- Совместимость с DLE 13.X
-##v2.0.0 от 09.05.2017
+## 2.0.0 от 09.05.2017
- Открытие исходников оригинального модуля для бесплатного использования.
diff --git a/README.md b/README.md
index 0376249..9658fbe 100644
--- a/README.md
+++ b/README.md
@@ -1,18 +1,23 @@
# Yandex Maps - модуль Яндекс карт для DLE
-![version](https://img.shields.io/badge/version-2.0.1-red.svg?style=flat-square "Version")
-![DLE](https://img.shields.io/badge/DLE-10.X-green.svg?style=flat-square "DLE Version")
+![version](https://img.shields.io/badge/version-3.0.0-red.svg?style=flat-square "Version")
+![DLE](https://img.shields.io/badge/DLE-13.X-green.svg?style=flat-square "DLE Version")
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/dle-modules/DLE-YandexMaps/blob/master/LICENSE)
**Модуль DLE Yandex Maps** предназначен для вывода в полной новости блока с Яндекс.Картой и точкой на ней, координаты и зум которой хранятся в дополнительном поле новости, а так же вывода, отфильтрованного по параметрам, JSON-массива с информацией о координатах точек с привязкой этих точек к соответсвующим новостям, для последующего размещения на Яндекс.Карте.
## Требования к системе
-- Версия DLE: **10.X и выше**
+- Версия DLE: **13.X и выше**
- Поддерживаемая кодировка: **UTF-8**
- Версия php: **5.4 и выше**
-## [Установка модуля](http://maps.pafnuty.name/documentation/#install)
+## Установка модуля
+Устанавливаем как обычный плагин, файл ymaps_plugin.zip содержит всё необходимое для автоматической установки.
-## [Документация](http://maps.pafnuty.name)
+## Настройка модуля
+http://maps.pafnuty.name/documentation/#setup
+
+## Документация
+http://maps.pafnuty.name
diff --git a/dle-yandexmaps.xml b/dle-yandexmaps.xml
new file mode 100644
index 0000000..c7b1916
--- /dev/null
+++ b/dle-yandexmaps.xml
@@ -0,0 +1,36 @@
+
+
+ DLE-YandexMaps
+ Яндекс карты для DLE
+ engine/skins/images/ymaps.png
+ 3.0.0
+ 13
+ greater
+ https://updates.pafnuty.name/check-ymaps.php
+ 0
+
+ 1
+
+
+
+
+
+
+
+
+
+
+ Release notes]]>
+
+
+ {$lang['header_n_title']} ", $lang['addnews'] );]]>
+ ';]]>
+
+
+
+
+
+ ';]]>
+
+
+
\ No newline at end of file
diff --git a/engine/ajax/ymaps_all.php b/engine/ajax/ymaps_all.php
new file mode 100644
index 0000000..1ee9a9c
--- /dev/null
+++ b/engine/ajax/ymaps_all.php
@@ -0,0 +1,253 @@
+
+ * @link https://git.io/v9irg
+ */
+
+if (!defined('DATALIFEENGINE')) {
+ header("HTTP/1.1 403 Forbidden");
+ header('Location: ../../');
+ die("Hacking attempt!");
+}
+
+
+$cfg = json_decode(file_get_contents(ENGINE_DIR.'/data/ymaps_config.json'), true);
+
+include(DLEPlugins::Check(ENGINE_DIR.'/modules/ymaps/language/Russian.lng'));
+
+$template_dir = ROOT_DIR.'/templates/'.$config['skin'];
+
+// Пытаемся получить даные из шаблона с настройками
+if ($_REQUEST['preset'] && file_exists($template_dir.'/ymaps/all/'.(string)$_REQUEST['preset'].'.tpl')) {
+ // Если файл существует - берём из него контент с настройками
+ $preset = file_get_contents($template_dir.'/ymaps/all/'.(string)$_REQUEST['preset'].'.tpl');
+ $arConf = [];
+} else {
+ die('error');
+}
+// Разбиваем полученные из файла нестройки по строкам
+$preset = explode("\n", $preset);
+
+// Пробегаем по массиву и формируем список настроек
+foreach ($preset as $v) {
+ $_v = explode('=', $v);
+ if (isset($_v[1])) {
+ $arConf[trim($_v[0])] = trim($_v[1]);
+ }
+}
+
+// Конфиг модуля
+$yMapCfg = [//
+ 'cachePrefix' => !empty($arConf['cachePrefix']) ? $arConf['cachePrefix'] : 'news_ym_all',
+ 'startFrom' => !empty($arConf['startFrom']) ? (int)$arConf['startFrom'] : '0',
+ // C какой новости начать вывод
+ 'limit' => !empty($arConf['limit']) ? (int)$arConf['limit'] : '1000',
+ // Максимальное количество выводимых точек
+ 'postId' => !empty($arConf['postId']) ? $arConf['postId'] : '',
+ // ID новостей для вывода в массиве (через запятую, или черточку)
+ 'notPostId' => !empty($arConf['notPostId']) ? $arConf['notPostId'] : '',
+ // ID игнорируемых новостей (через запятую, или черточку)
+ 'catId' => !empty($arConf['catId']) ? $arConf['catId'] : '',
+ // Категории для показа (через запятую, или черточку)
+ 'subcats' => !empty($arConf['subcats']) ? $arConf['subcats'] : false,
+ // Выводить подкатегории указанных категорий (&subcats=y), работает и с диапазонами.
+ 'notCatId' => !empty($arConf['notCatId']) ? $arConf['notCatId'] : '',
+ // Игнорируемые категории (через запятую, или черточку)
+ 'notSubcats' => !empty($arConf['notSubcats']) ? $arConf['notSubcats'] : false,
+ // Игнорировать подкатегории игнорируемых категорий (¬Subcats=y), работает и с диапазонами.
+ 'type' => !empty($arConf['type']) ? $arConf['type'] : 'json',
+ // Тип возвращаемых данных. Пока только json т.к. это наиболее правильный вариант
+];
+
+if ($yMapCfg['catId'] == 'this' || $yMapCfg['notCatId'] == 'this') {
+ $url = parse_url($_SERVER['HTTP_REFERER']);
+ $path = $url['path'];
+
+ $arPath = explode('/', $path);
+
+ $category_id = false;
+
+ foreach ($cat_info as $key => $cat) {
+ if ($cat['alt_name'] == $arPath[1]) {
+ $category_id = $cat['id'];
+ break;
+ }
+ }
+}
+
+// Если имеются переменные со значениями this, изменяем значение переменной cacheNameAddon
+if ($yMapCfg['catId'] == 'this') {
+ $yMapCfg['cacheNameAddon'] .= $category_id.'cId_';
+}
+if ($yMapCfg['notCatId'] == 'this') {
+ $yMapCfg['cacheNameAddon'] .= $category_id.'nCId_';
+}
+if ($yMapCfg['postId'] == 'this') {
+ $yMapCfg['cacheNameAddon'] .= $_REQUEST["newsid"].'pId_';
+}
+if ($yMapCfg['notPostId'] == 'this') {
+ $yMapCfg['cacheNameAddon'] .= $_REQUEST["newsid"].'nPId_';
+}
+
+$cacheName = md5(implode('_', $yMapCfg)).$config['skin'];
+$yMap = false;
+$yMap = dle_cache($yMapCfg['cachePrefix'], $cacheName.$config['skin'], $yMapCfg['cacheSuffix']);
+if (!$yMap) {
+
+ $mapHeight = ($cfg['main']['mapHeight']) ? $cfg['main']['mapHeight'] : '400';
+ $controls = $cfg['main']['controls'];
+ $controls = array_keys($controls);
+ $controls = json_encode($controls);
+
+ $catPoints = $cfg['pointSettings']['catPoints'];
+
+ // Массив с условиями запроса
+ $wheres = [];
+ $wheres[] = 'approve';
+
+ // Фильтрация КАТЕГОРИЙ по их ID
+ if ($yMapCfg['catId'] == 'this') {
+ $yMapCfg['catId'] = ($yMapCfg['subcats']) ? get_sub_cats($category_id) : $category_id;
+ }
+ if ($yMapCfg['notCatId'] == 'this') {
+ $yMapCfg['notCatId'] = ($yMapCfg['notSubcats']) ? get_sub_cats($category_id) : $category_id;
+ }
+
+ if ($yMapCfg['catId'] || $yMapCfg['notCatId']) {
+ $ignore = ($yMapCfg['notCatId']) ? 'NOT ' : '';
+ $catArr = ($yMapCfg['notCatId']) ? getDiapazone($yMapCfg['notCatId'], $yMapCfg['notSubcats'])
+ : getDiapazone($yMapCfg['catId'], $yMapCfg['subcats']);
+ $wheres[] = $ignore.'category regexp "[[:<:]]('.str_replace(',', '|', $catArr).')[[:>:]]"';
+ }
+
+ // Фильтрация НОВОСТЕЙ по их ID
+ if ($yMapCfg['postId'] == 'this') {
+ $yMapCfg['postId'] = $_REQUEST["newsid"];
+ }
+ if ($yMapCfg['notPostId'] == 'this') {
+ $yMapCfg['notPostId'] = $_REQUEST["newsid"];
+ }
+
+ if (($yMapCfg['postId'] || $yMapCfg['notPostId']) && $yMapCfg['related'] == '') {
+ $ignorePosts = ($yMapCfg['notPostId']) ? 'NOT ' : '';
+ $postsArr = ($yMapCfg['notPostId']) ? getDiapazone($yMapCfg['notPostId']) : getDiapazone($yMapCfg['postId']);
+ $wheres[] = $ignorePosts.'id regexp "[[:<:]]('.str_replace(',', '|', $postsArr).')[[:>:]]"';
+ }
+
+ // Условие для отбора новостей, у которых есть координаты точек
+ $wheres[] = 'xfields regexp "[[:<:]]('.$cfg['main']['coordsField'].')[[:>:]]"';
+
+ // Складываем условия
+ $where = (count($wheres)) ? ' WHERE '.implode(' AND ', $wheres) : '';
+
+ // Выполняем запрос
+ $row = $db->super_query("SELECT id, title, category, xfields FROM ".PREFIX."_post ".$where." LIMIT "
+ .$yMapCfg['startFrom'].", ".$yMapCfg['limit'], true);
+
+ $geoObjects = [];
+ if (count($row) > 0) {
+ foreach ($row as $key => $placemark) {
+ $geoObject = [];
+ // Определяем ID геообъекта
+ $geoObject['id'] = (int)$placemark['id'];
+
+ $geoObject['type'] = 'Feature';
+
+ $_catId = intval($placemark['category']);
+ $geoObject['category'] = $_catId;
+
+ $catPoint = ($catPoints[$_catId]) ? $_catId : 'default';
+ $placemarkStyle = $catPoints[$catPoint];
+
+ // небольшой костылёк для приведения типов, иначе я.карта не воспринимает.
+ if ($placemarkStyle['iconImageSize']) {
+ $placemarkStyle['iconImageSize'][0] = (int)$placemarkStyle['iconImageSize'][0];
+ $placemarkStyle['iconImageSize'][1] = (int)$placemarkStyle['iconImageSize'][1];
+ }
+ if ($placemarkStyle['iconImageOffset']) {
+ $placemarkStyle['iconImageOffset'][0] = (int)$placemarkStyle['iconImageOffset'][0];
+ $placemarkStyle['iconImageOffset'][1] = (int)$placemarkStyle['iconImageOffset'][1];
+ }
+
+ $geoObject['options'] = $placemarkStyle;
+ $title = htmlspecialchars(strip_tags(stripslashes($placemark['title'])),
+ ENT_QUOTES, $config['charset']);
+ $geoObject['properties']['clusterCaption'] = $title;
+ $geoObject['properties']['hintContent'] = $title;
+
+ $xf = xfieldsdataload($placemark['xfields']);
+
+ $xfCo_ = html_entity_decode($xf[$cfg['main']['coordsField']], ENT_COMPAT);
+
+ $xfCoords = json_decode($xfCo_, true);
+
+
+ $geoObject['geometry']['type'] = 'Point';
+ $geoObject['geometry']['coordinates'][0] = $xfCoords['lat'];
+ $geoObject['geometry']['coordinates'][1] = $xfCoords['lon'];
+
+ $geoObjects[] = $geoObject;
+ }
+ }
+ $yMap['type'] = 'FeatureCollection';
+ $yMap['features'] = $geoObjects;
+
+ $yMap = json_encode($yMap);
+
+ create_cache($yMapCfg['cachePrefix'], $yMap, $cacheName.$config['skin'], true);
+}
+die($yMap);
+
+/**
+ * Получение диапазона между двумя цифрами, и не только
+ *
+ * @param bool $diapazone
+ * @param bool $subcats
+ *
+ * @return string
+ * @internal param string $diapasone
+ * @author Elkhan I. Isaev
+ */
+function getDiapazone($diapazone = false, $subcats = false) {
+ if ($diapazone !== false) {
+ $diapazone = str_replace(" ", "", $diapazone);
+ if (strpos($diapazone, ',') !== false) {
+ $diapazoneArray = explode(',', $diapazone);
+ $diapazoneArray = array_diff($diapazoneArray, [null]);
+ foreach ($diapazoneArray as $v) {
+ if (strpos($v, '-') !== false) {
+ preg_match("#(\d+)-(\d+)#i", $v, $test);
+ $diapazone = !empty($diapazone) && is_array($diapazone) ? array_merge($diapazone,
+ (!empty ($test) ? range($test[1], $test[2]) : []))
+ : (!empty ($test) ? range($test[1], $test[2]) : []);
+ } else {
+ $diapazone = !empty($diapazone) && is_array($diapazone) ? array_merge($diapazone,
+ (!empty ($v) ? [(int)$v] : [])) : (!empty ($v) ? [(int)$v] : []);
+ }
+ }
+ } elseif (strpos($diapazone, '-') !== false) {
+ preg_match("#(\d+)-(\d+)#i", $diapazone, $test);
+ $diapazone = !empty ($test) ? range($test[1], $test[2]) : [];
+ } else {
+ $diapazone = [(int)$diapazone];
+ }
+ if (!empty($diapazone)) {
+ if ($subcats && function_exists('get_sub_cats')) {
+ foreach ($diapazone as $d) {
+ $_sc = explode('|', get_sub_cats($d));
+ foreach ($_sc as $v) {
+ array_push($diapazone, $v);
+ }
+ }
+ }
+ $diapazone = array_unique($diapazone);
+ } else {
+ $diapazone = [];
+ }
+ $diapazone = implode(',', $diapazone);
+ }
+
+ return $diapazone;
+}
diff --git a/engine/ajax/ymaps_cat.php b/engine/ajax/ymaps_cat.php
new file mode 100644
index 0000000..6f7e864
--- /dev/null
+++ b/engine/ajax/ymaps_cat.php
@@ -0,0 +1,263 @@
+
+ * @link https://git.io/v9irg
+ */
+
+if (!defined('DATALIFEENGINE')) {
+ header("HTTP/1.1 403 Forbidden");
+ header('Location: ../../');
+ die("Hacking attempt!");
+}
+
+
+$cfg = json_decode(file_get_contents(ENGINE_DIR.'/data/ymaps_config.json'), true);
+$icons = json_decode(file_get_contents(ENGINE_DIR.'/data/ymaps_icons.json'), true);
+
+include(DLEPlugins::Check(ENGINE_DIR.'/modules/ymaps/language/Russian.lng'));
+
+$template_dir = ROOT_DIR.'/templates/'.$config['skin'];
+
+// Пытаемся получить даные из шаблона с настройками
+if ($_REQUEST['preset'] && file_exists($template_dir.'/ymaps/all/'.(string)$_REQUEST['preset'].'.tpl')) {
+ // Если файл существует - берём из него контент с настройками
+ $preset = file_get_contents($template_dir.'/ymaps/all/'.(string)$_REQUEST['preset'].'.tpl');
+ $arConf = [];
+} else {
+ die('error');
+}
+// Разбиваем полученные из файла нестройки по строкам
+$preset = explode("\n", $preset);
+
+// Пробегаем по массиву и формируем список настроек
+foreach ($preset as $v) {
+ $_v = explode('=', $v);
+ if (isset($_v[1])) {
+ $arConf[trim($_v[0])] = trim($_v[1]);
+ }
+}
+
+// Конфиг модуля
+$yMapCfg = [
+ 'cachePrefix' => !empty($arConf['cachePrefix']) ? $arConf['cachePrefix'] : 'news_ym_cat',
+ 'startFrom' => !empty($arConf['startFrom']) ? (int)$arConf['startFrom'] : '0',
+ // C какой новости начать вывод
+ 'limit' => !empty($arConf['limit']) ? (int)$arConf['limit'] : '1000',
+ // Максимальное количество выводимых точек
+ 'postId' => !empty($arConf['postId']) ? $arConf['postId'] : '',
+ // ID новостей для вывода в массиве (через запятую, или черточку)
+ 'notPostId' => !empty($arConf['notPostId']) ? $arConf['notPostId'] : '',
+ // ID игнорируемых новостей (через запятую, или черточку)
+ 'catId' => !empty($_REQUEST['catId']) ? $_REQUEST['catId']
+ : (!empty($arConf['catId']) ? $arConf['catId'] : ''),
+ // Категории для показа (id одной категории или this)
+ 'subcats' => !empty($arConf['subcats']) ? $arConf['subcats'] : false,
+ // Выводить подкатегории указанных категорий (&subcats=y), работает и с диапазонами.
+ 'notCatId' => !empty($arConf['notCatId']) ? $arConf['notCatId'] : '',
+ // Игнорируемые категории (через запятую, или черточку)
+ 'notSubcats' => !empty($arConf['notSubcats']) ? $arConf['notSubcats'] : false,
+ // Игнорировать подкатегории игнорируемых категорий (¬Subcats=y), работает и с диапазонами.
+ 'type' => !empty($arConf['type']) ? $arConf['type'] : 'json',
+ // Тип возвращаемых данных. Пока только json т.к. это наиболее правильный вариант
+];
+
+if ($yMapCfg['catId'] == 'this' || $yMapCfg['notCatId'] == 'this') {
+ $url = parse_url($_SERVER['HTTP_REFERER']);
+ $path = $url['path'];
+
+ $arPath = explode('/', $path);
+
+ $category_id = false;
+
+ foreach ($cat_info as $key => $cat) {
+ if ($cat['alt_name'] == $arPath[1]) {
+ $category_id = $cat['id'];
+ break;
+ }
+ }
+}
+
+// Если имеются переменные со значениями this, изменяем значение переменной cacheNameAddon
+if ($yMapCfg['catId'] == 'this') {
+ $yMapCfg['cacheNameAddon'] .= $category_id.'cId_';
+}
+if ($yMapCfg['notCatId'] == 'this') {
+ $yMapCfg['cacheNameAddon'] .= $category_id.'nCId_';
+}
+if ($yMapCfg['postId'] == 'this') {
+ $yMapCfg['cacheNameAddon'] .= $_REQUEST["newsid"].'pId_';
+}
+if ($yMapCfg['notPostId'] == 'this') {
+ $yMapCfg['cacheNameAddon'] .= $_REQUEST["newsid"].'nPId_';
+}
+
+$cacheName = md5(implode('_', $yMapCfg)).$config['skin'];
+$yMap = false;
+$yMap = dle_cache($yMapCfg['cachePrefix'], $cacheName.$config['skin'], $yMapCfg['cacheSuffix']);
+if (!$yMap) {
+
+ if (in_array($yMapCfg['catId'], getDiapazone($yMapCfg['notCatId'], $yMapCfg['notSubcats']))) {
+ die('wrong category');
+ }
+
+ $mapHeight = ($cfg['main']['mapHeight']) ? $cfg['main']['mapHeight'] : '400';
+ $controls = $cfg['main']['controls'];
+ $controls = array_keys($controls);
+ $controls = json_encode($controls);
+
+ $catPoints = $cfg['pointSettings']['catPoints'];
+
+ // Массив с условиями запроса
+ $wheres = [];
+ $wheres[] = 'approve';
+
+ // Фильтрация КАТЕГОРИЙ по их ID
+ if ($yMapCfg['catId'] == 'this') {
+ $yMapCfg['catId'] = ($yMapCfg['subcats']) ? get_sub_cats($category_id) : $category_id;
+ } else {
+ $yMapCfg['catId'] = ((int)$yMapCfg['catId'] > 0) ? (int)$yMapCfg['catId'] : false;
+ }
+
+ if ($yMapCfg['notCatId'] == 'this') {
+ $yMapCfg['notCatId'] = ($yMapCfg['notSubcats']) ? get_sub_cats($category_id) : $category_id;
+ }
+
+
+ if ($yMapCfg['catId'] || $yMapCfg['notCatId']) {
+ $ignore = ($yMapCfg['notCatId']) ? 'NOT ' : '';
+ $catArr = ($yMapCfg['notCatId']) ? getDiapazone($yMapCfg['notCatId'], $yMapCfg['notSubcats'])
+ : ($yMapCfg['subcats']) ? get_sub_cats($yMapCfg['catId']) : $yMapCfg['catId'];
+ $wheres[] = $ignore.'category regexp "[[:<:]]('.str_replace(',', '|', $catArr).')[[:>:]]"';
+ }
+
+ // Фильтрация НОВОСТЕЙ по их ID
+ if ($yMapCfg['postId'] == 'this') {
+ $yMapCfg['postId'] = $_REQUEST["newsid"];
+ }
+ if ($yMapCfg['notPostId'] == 'this') {
+ $yMapCfg['notPostId'] = $_REQUEST["newsid"];
+ }
+
+ if (($yMapCfg['postId'] || $yMapCfg['notPostId']) && $yMapCfg['related'] == '') {
+ $ignorePosts = ($yMapCfg['notPostId']) ? 'NOT ' : '';
+ $postsArr = ($yMapCfg['notPostId']) ? getDiapazone($yMapCfg['notPostId']) : getDiapazone($yMapCfg['postId']);
+ $wheres[] = $ignorePosts.'id regexp "[[:<:]]('.str_replace(',', '|', $postsArr).')[[:>:]]"';
+ }
+
+ // Условие для отбора новостей, у которых есть координаты точек
+ $wheres[] = 'xfields regexp "[[:<:]]('.$cfg['main']['coordsField'].')[[:>:]]"';
+
+ // Складываем условия
+ $where = (count($wheres)) ? ' WHERE '.implode(' AND ', $wheres) : '';
+
+ // Выполняем запрос
+ $row = $db->super_query("SELECT id, title, category, xfields FROM ".PREFIX."_post ".$where." LIMIT "
+ .$yMapCfg['startFrom'].", ".$yMapCfg['limit'], true);
+
+ $geoObjects = [];
+ if (count($row) > 0) {
+ foreach ($row as $key => $placemark) {
+ $geoObject = [];
+ // Определяем ID геообъекта
+ $geoObject['id'] = (int)$placemark['id'];
+
+ $geoObject['type'] = 'Feature';
+
+ $_catId = intval($placemark['category']);
+ $geoObject['category'] = $_catId;
+
+ $catPoint = ($catPoints[$_catId]) ? $_catId : 'default';
+ $placemarkStyle = $catPoints[$catPoint];
+
+ // небольшой костылёк для приведения типов, иначе я.карта не воспринимает.
+ if ($placemarkStyle['iconImageSize']) {
+ $placemarkStyle['iconImageSize'][0] = (int)$placemarkStyle['iconImageSize'][0];
+ $placemarkStyle['iconImageSize'][1] = (int)$placemarkStyle['iconImageSize'][1];
+ }
+ if ($placemarkStyle['iconImageOffset']) {
+ $placemarkStyle['iconImageOffset'][0] = (int)$placemarkStyle['iconImageOffset'][0];
+ $placemarkStyle['iconImageOffset'][1] = (int)$placemarkStyle['iconImageOffset'][1];
+ }
+
+ $geoObject['options'] = $placemarkStyle;
+ $title = htmlspecialchars(strip_tags(stripslashes($placemark['title'])),
+ ENT_QUOTES, $config['charset']);
+ $geoObject['properties']['clusterCaption'] = $title;
+ $geoObject['properties']['hintContent'] = $title;
+
+ $xf = xfieldsdataload($placemark['xfields']);
+
+ $xfCo_ = html_entity_decode($xf[$cfg['main']['coordsField']], ENT_COMPAT);
+
+ $xfCoords = json_decode($xfCo_, true);
+
+
+ $geoObject['geometry']['type'] = 'Point';
+ $geoObject['geometry']['coordinates'][0] = $xfCoords['lat'];
+ $geoObject['geometry']['coordinates'][1] = $xfCoords['lon'];
+
+ $geoObjects[] = $geoObject;
+ }
+ }
+ $yMap['type'] = 'FeatureCollection';
+ $yMap['features'] = $geoObjects;
+
+ $yMap = json_encode($yMap);
+
+ create_cache($yMapCfg['cachePrefix'], $yMap, $cacheName.$config['skin'], true);
+}
+die($yMap);
+
+/**
+ * Получение диапазона между двумя цифрами, и не только
+ *
+ * @param bool $diapazone
+ * @param bool $subcats
+ *
+ * @return string
+ * @internal param string $diapasone
+ * @author Elkhan I. Isaev
+ */
+function getDiapazone($diapazone = false, $subcats = false) {
+ if ($diapazone !== false) {
+ $diapazone = str_replace(" ", "", $diapazone);
+ if (strpos($diapazone, ',') !== false) {
+ $diapazoneArray = explode(',', $diapazone);
+ $diapazoneArray = array_diff($diapazoneArray, [null]);
+ foreach ($diapazoneArray as $v) {
+ if (strpos($v, '-') !== false) {
+ preg_match("#(\d+)-(\d+)#i", $v, $test);
+ $diapazone = !empty($diapazone) && is_array($diapazone) ? array_merge($diapazone,
+ (!empty ($test) ? range($test[1], $test[2]) : []))
+ : (!empty ($test) ? range($test[1], $test[2]) : []);
+ } else {
+ $diapazone = !empty($diapazone) && is_array($diapazone) ? array_merge($diapazone,
+ (!empty ($v) ? [(int)$v] : [])) : (!empty ($v) ? [(int)$v] : []);
+ }
+ }
+ } elseif (strpos($diapazone, '-') !== false) {
+ preg_match("#(\d+)-(\d+)#i", $diapazone, $test);
+ $diapazone = !empty ($test) ? range($test[1], $test[2]) : [];
+ } else {
+ $diapazone = [(int)$diapazone];
+ }
+ if (!empty($diapazone)) {
+ if ($subcats && function_exists('get_sub_cats')) {
+ foreach ($diapazone as $d) {
+ $_sc = explode('|', get_sub_cats($d));
+ foreach ($_sc as $v) {
+ array_push($diapazone, $v);
+ }
+ }
+ }
+ $diapazone = array_unique($diapazone);
+ } else {
+ $diapazone = [];
+ }
+ $diapazone = implode(',', $diapazone);
+ }
+
+ return $diapazone;
+}
diff --git a/engine/ajax/ymaps_editmarker.php b/engine/ajax/ymaps_editmarker.php
new file mode 100644
index 0000000..b5072fd
--- /dev/null
+++ b/engine/ajax/ymaps_editmarker.php
@@ -0,0 +1,191 @@
+
+ * @link https://git.io/v9irg
+ */
+
+if (!defined('DATALIFEENGINE')) {
+ header("HTTP/1.1 403 Forbidden");
+ header('Location: ../../');
+ die("Hacking attempt!");
+}
+
+
+/**
+ * Основной код файла
+ */
+
+if ($member_id['user_group'] == '1') {
+
+ include(DLEPlugins::Check(ENGINE_DIR.'/modules/ymaps/language/Russian.lng'));
+
+ $cfg = json_decode(file_get_contents(ENGINE_DIR.'/data/ymaps_config.json'), true);
+ $icons = json_decode(file_get_contents(ENGINE_DIR.'/data/ymaps_icons.json'), true);
+
+ function showCustomIconList($id = 0) {
+ global $config, $cfg;
+
+ $arImages = [];
+ $tplPiconPath = 'templates/'.$config['skin'].'/ymaps/icons/';
+
+ $dir = ROOT_DIR.'/'.$tplPiconPath;
+ $images = scandir($dir);
+ $arPoint = $cfg['pointSettings']['catPoints'][$id];
+
+ if ($images !== false) {
+ $images = preg_grep('/\\.(?:png|gif|jpe?g)$/', $images);
+ foreach ($images as $image) {
+ $imgSize = getimagesize($dir.'/'.$image);
+ $selected = ($arPoint['iconImageHref'] == $config['http_home_url'].$tplPiconPath.$image)
+ ? 'selected' : false;
+ $offsetWidth = ($selected) ? $arPoint['iconImageOffset'][0] : false;
+ $offsetHeight = ($selected) ? $arPoint['iconImageOffset'][1] : false;
+ $arImages[] = [
+ 'name' => $image,
+ 'src' => $config['http_home_url'].$tplPiconPath.$image,
+ 'width' => $imgSize[0],
+ 'height' => $imgSize[1],
+ 'offsetWidth' => $offsetWidth,
+ 'offsetHeight' => $offsetHeight,
+ 'selected' => $selected,
+ ];
+ }
+ }
+
+ return $arImages;
+ }
+
+ function getIconsArray($array = [], $id = 0, $type = '') {
+ global $cfg, $module_lang;
+ $arPoint = $cfg['pointSettings']['catPoints'][$id];
+ $option = [];
+
+ foreach ($array as $name => $value) {
+ $pointColor = ($arPoint['iconColor']) ? $arPoint['iconColor'] : '#4a9fc5';
+ $customColor = ($name == $type) ? 'data-icon-color = "'.$pointColor.'"' : '';
+ $name = str_replace(['islands#', 'StretchyIcon'], ['', 'Str'], $name);
+
+ $customName = ($name == $type) ? $name.$module_lang['markerCustomColor'] : $name;
+
+ $selected = (in_array($value, $arPoint)) ? 'selected' : '';
+ $option[] = ''.$customName.' ';
+
+ }
+
+ return implode("\n", $option);
+ }
+
+ if ($_REQUEST['id'] == 'default') {
+ $arCat['id'] = 'default';
+ $arCat['name'] = $module_lang['pointersCatDefault'];
+ $headerTextPrefix = '';
+ } else {
+ $catId = (int)$_REQUEST['id'];
+ $arCat = $db->super_query("SELECT id, name FROM ".PREFIX."_category WHERE id=".$catId);
+ $headerTextPrefix = $module_lang['moduleTextMarkerSettingsHeader'];
+ }
+
+ if ($arCat['id'] > 0 || $arCat['id'] == 'default') {
+ $optionsCustomIcons = [];
+
+ foreach (showCustomIconList($arCat['id']) as $option) {
+ $optionsCustomIcons[] = ''.$option['name'].' ';
+ }
+ $optionsCustomIcons = implode("\n", $optionsCustomIcons);
+
+ $customSelect = ($cfg['pointSettings']['catPoints'][$arCat['id']]['iconLayout']) ? 'selected' : '';
+
+ $showResult = '';
+ } else {
+ $showResult = '
+
+
+
'.$module_lang['catIdWrong'].'
+
+
';
+ }
+
+ die ($showResult);
+} else {
+ die ('Access denied');
+}
+
diff --git a/engine/ajax/ymaps_editnews.php b/engine/ajax/ymaps_editnews.php
new file mode 100644
index 0000000..18c5dfc
--- /dev/null
+++ b/engine/ajax/ymaps_editnews.php
@@ -0,0 +1,82 @@
+
+ * @link https://git.io/v9irg
+ */
+
+if (!defined('DATALIFEENGINE')) {
+ header("HTTP/1.1 403 Forbidden");
+ header('Location: ../../../');
+ die("Hacking attempt!");
+}
+
+if (!$is_logged) {
+ die('error');
+}
+
+define('ENGINE_DIR', ROOT_DIR.'/engine');
+
+$cfg = json_decode(file_get_contents(ENGINE_DIR.'/data/ymaps_config.json'));
+
+include(DLEPlugins::Check(ENGINE_DIR.'/modules/ymaps/language/Russian.lng'));
+
+$key = ($cfg->main->apiKey) ? '&apikey='.$cfg->main->apiKey : '';
+
+$mapHeight = ($cfg->main->mapHeight) ? $cfg->main->mapHeight : '400';
+$controls = (array)$cfg->main->controls;
+$controls = array_keys($controls);
+$mapSelector = 'ymaps-edit-map-container';
+
+$modalHtml = <<
+
+
+HTML;
+
+$btnHtml = <<editmap
+×
+HTML;
+
+
+$ymapsJson = [
+ 'mapSelector' => $mapSelector,
+ 'mapUrl' => 'https://api-maps.yandex.ru/2.1/?lang=ru_RU'.$key,
+ 'scripts' => [
+ '/engine/modules/ymaps/js/jquery.magnificpopup.min.js',
+ ],
+ 'controls' => $controls,
+ 'height' => $cfg->main->mapHeight,
+ 'defaultPos' => [
+ 'lat' => $cfg->main->mapCenter->latitude,
+ 'lon' => $cfg->main->mapCenter->longitude,
+ 'zoom' => $cfg->main->mapCenter->zoom,
+ ],
+ 'arPlacemarkStyles' => $cfg->pointSettings->catPoints,
+ 'inputSelector' => '[name="xfield['.$cfg->main->coordsField.']"]',
+ 'xfHolder' => '#xfield_holder_'.$cfg->main->coordsField,
+ 'modalHtml' => $modalHtml,
+ 'btnHtml' => $btnHtml,
+ 'text' => [
+ 'edit' => $module_lang['moduleTextEditPlacemark'],
+ 'add' => $module_lang['moduleTextAddPlacemark'],
+ ],
+];
+
+
+header('Content-Type: application/json');
+echo json_encode($ymapsJson);
diff --git a/engine/ajax/ymaps_saveconfig.php b/engine/ajax/ymaps_saveconfig.php
new file mode 100644
index 0000000..c756fd6
--- /dev/null
+++ b/engine/ajax/ymaps_saveconfig.php
@@ -0,0 +1,54 @@
+
+ * @link https://git.io/v9irg
+ */
+
+if (!defined('DATALIFEENGINE')) {
+ header("HTTP/1.1 403 Forbidden");
+ header('Location: ../../');
+ die("Hacking attempt!");
+}
+
+
+/**
+ * Основной код файла
+ */
+
+if ($member_id['user_group'] == '1') {
+
+ $cfg = json_decode(file_get_contents(ENGINE_DIR . '/data/ymaps_config.json'), true);
+
+ if ($_POST['pointID'] > 0 || $_POST['pointID'] == 'default') {
+ $post = array_filter($_POST);
+
+ $catId = $post['pointID'];
+ unset($post['pointID']);
+ if (isset($post['preset']) && isset($post['iconColor'])) {
+ $cfg['pointSettings']['catPoints'][$catId] = ['preset' => $post['preset'],
+ 'iconColor' => $post['iconColor'],
+ ];
+ } elseif (isset($post['iconLayout'])) {
+ unset($post['preset']);
+ $cfg['pointSettings']['catPoints'][$catId] = $post;
+ } elseif ($post['preset']) {
+ $cfg['pointSettings']['catPoints'][$catId] = ['preset' => $post['preset'],];
+ }
+ if (isset($_POST['deletePoint']) && $_POST['deletePoint'] == 'y') {
+ unset($cfg['pointSettings']['catPoints'][$catId]);
+ }
+
+ }
+ if ($_POST['mapsettings']) {
+ unset($_POST['mapsettings']);
+ $cfg['main'] = $_POST;
+ }
+
+ $jsn = json_encode($cfg);
+ file_put_contents(ENGINE_DIR.'/data/ymaps_config.json', $jsn);
+ die ($jsn);
+} else {
+ die ('Access denied');
+}
\ No newline at end of file
diff --git a/engine/ajax/ymaps_xfields.php b/engine/ajax/ymaps_xfields.php
new file mode 100644
index 0000000..cd31a1c
--- /dev/null
+++ b/engine/ajax/ymaps_xfields.php
@@ -0,0 +1,55 @@
+
+ * @link https://git.io/v9irg
+ */
+
+if (!defined('DATALIFEENGINE')) {
+ header("HTTP/1.1 403 Forbidden");
+ header('Location: ../../');
+ die("Hacking attempt!");
+}
+
+/**
+ * Основной код файла
+ */
+if ($member_id['user_group'] == '1') {
+ include_once(DLEPlugins::Check(ENGINE_DIR.'/modules/ymaps/language/Russian.lng'));
+ require_once(DLEPlugins::Check(ENGINE_DIR.'/modules/ymaps/admin/classes/xfields.php'));
+
+ $fun = new xfClass;
+ $name = (isset($_REQUEST['name'])) ? $db->safesql($_REQUEST['name']) : false;
+ $description = (isset($_REQUEST['description'])) ? $db->safesql($_REQUEST['description']) : false;
+ $value = (isset($_REQUEST['value'])) ? $db->safesql($_REQUEST['value']) : false;
+ $fieldType = (isset($_REQUEST['fieldType'])) ? $db->safesql($_REQUEST['fieldType']) : false;
+
+ $xf = $fun->xf('add', $name, $description, $value, $fieldType)->result;
+
+ if ($xf) {
+ $content = ''.$module_lang['field'].' '.$name.' '
+ .$module_lang['successfullyСreated'].'
';
+ } else {
+ $content = ''.$module_lang['errTryAgainLater'].'
';
+ }
+
+ $showResult = '';
+
+ die ($showResult);
+} else {
+ die ('Access denied');
+}
\ No newline at end of file
diff --git a/upload/engine/data/ymaps_config.json b/engine/data/ymaps_config.json
similarity index 57%
rename from upload/engine/data/ymaps_config.json
rename to engine/data/ymaps_config.json
index d451cbc..cb20477 100644
--- a/upload/engine/data/ymaps_config.json
+++ b/engine/data/ymaps_config.json
@@ -1,13 +1,5 @@
{
- "moduleName": "ymaps",
- "moduleTitle": "Yandex Maps",
- "moduleDescr": "Модуль Яндекс.Карты для DLE",
- "moduleVersion": "2.0.1",
- "moduleDate": "16.10.2018",
- "dleVersion": "10.x",
"main": {
- "moduleLang": "Russian",
- "licenceKey": "",
"apiKey": "",
"mapHeight": "450",
"controls": {
@@ -24,6 +16,5 @@
"coordsField": ""
},
"pointSettings": {
-
}
}
\ No newline at end of file
diff --git a/upload/engine/data/ymaps_icons.json b/engine/data/ymaps_icons.json
similarity index 100%
rename from upload/engine/data/ymaps_icons.json
rename to engine/data/ymaps_icons.json
diff --git a/engine/inc/ymaps.php b/engine/inc/ymaps.php
new file mode 100644
index 0000000..a7ca5f5
--- /dev/null
+++ b/engine/inc/ymaps.php
@@ -0,0 +1,111 @@
+
+ * @link https://git.io/v9irg
+ */
+
+if (!defined('DATALIFEENGINE') OR !defined('LOGGED_IN')) {
+ die("Hacking attempt!");
+}
+if ($member_id['user_group'] != '1') {
+ msg("error", $lang['index_denied'], $lang['index_denied']);
+}
+
+/**
+ * Конфиг модуля
+ */
+$cfg = json_decode(file_get_contents(ENGINE_DIR.'/data/ymaps_config.json'));
+
+define('MODULE_DIR', ENGINE_DIR.'/modules/ymaps');
+
+include_once(DLEPlugins::Check(MODULE_DIR.'/language/Russian.lng'));
+
+$key = ($cfg->main->apiKey) ? '&apikey=' . $cfg->main->apiKey : '';
+
+?>
+
+
+
+
+ = $module_lang['moduleTitle'] ?> - = $module_lang['moduleTextManagment'] ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ = $module_lang['moduleTitle'] ?>
+
+
+
+
+
+
+
+
+ = $module_lang['mapSettings'] ?>
+ = $module_lang['mapsPointSettings'] ?>
+ = $module_lang['mapsSupport'] ?>
+
+
+
+
+ include(DLEPlugins::Check(MODULE_DIR.'/admin/mapsettings.php')); ?>
+
+
+ include(DLEPlugins::Check(MODULE_DIR.'/admin/pointersettings.php')); ?>
+
+
+ include(DLEPlugins::Check(MODULE_DIR.'/admin/support.php')); ?>
+
+
+
+
+
+
+
+
+
+
diff --git a/upload/engine/modules/ymaps/.htaccess b/engine/modules/ymaps/.htaccess
similarity index 100%
rename from upload/engine/modules/ymaps/.htaccess
rename to engine/modules/ymaps/.htaccess
diff --git a/engine/modules/ymaps/addnews-inline.php b/engine/modules/ymaps/addnews-inline.php
new file mode 100644
index 0000000..82c2ebf
--- /dev/null
+++ b/engine/modules/ymaps/addnews-inline.php
@@ -0,0 +1,60 @@
+
+ * @link https://git.io/v9irg
+ */
+
+if (!defined('DATALIFEENGINE')) {
+ header("HTTP/1.1 403 Forbidden");
+ die("Hacking attempt!");
+}
+global $onload_scripts, $js_array;
+
+$cfg = json_decode(file_get_contents(ENGINE_DIR . '/data/ymaps_config.json'));
+
+define('MODULE_DIR', ENGINE_DIR . '/modules/ymaps/');
+
+define('MODULE_DIR', ENGINE_DIR . '/modules/ymaps/');
+
+if (@file_exists(MODULE_DIR . '/language/Russian.lng')) {
+ include(DLEPlugins::Check(MODULE_DIR . '/language/Russian.lng'));
+} else {
+ die("Language file not found");
+}
+
+$key = ($cfg->main->apiKey) ? '&apikey=' . $cfg->main->apiKey : '';
+
+$js_array[] = '/templates/' . $config['skin'] . '/ymaps/ymaps.js';
+
+$mapHeight = ($cfg->main->mapHeight) ? $cfg->main->mapHeight : '400';
+$controls = (array)$cfg->main->controls;
+$controls = array_keys($controls);
+$controls = json_encode($controls);
+$arPlacemarkStyles = ($cfg->pointSettings->catPoints) ? json_encode($cfg->pointSettings->catPoints) : '{}';
+$mapSelector = 'ymaps-map-container';
+
+$onload_scripts[] = <<main->mapHeight},
+ coordsFieldText:'',
+ defaultPos: {
+ lat: '{$cfg->main->mapCenter->latitude}',
+ lon: '{$cfg->main->mapCenter->longitude}',
+ zoom: '{$cfg->main->mapCenter->zoom}',
+ },
+ arPlacemarkStyles: {$arPlacemarkStyles},
+ inputSelector: '[name="xfield[{$cfg->main->coordsField}]"]',
+ xfHolder: '#xfield_holder_{$cfg->main->coordsField}'
+ }
+ if (addNewsMapStart) {
+ addNewsMapStart(mapConfig);
+ };
+HTML;
+
+echo '
';
\ No newline at end of file
diff --git a/engine/modules/ymaps/addnews.php b/engine/modules/ymaps/addnews.php
new file mode 100644
index 0000000..bf1be8b
--- /dev/null
+++ b/engine/modules/ymaps/addnews.php
@@ -0,0 +1,66 @@
+
+ * @link https://git.io/v9irg
+ */
+
+if (!defined('DATALIFEENGINE')) {
+ header("HTTP/1.1 403 Forbidden");
+ die("Hacking attempt!");
+}
+global $onload_scripts, $js_array;
+
+$cfg = json_decode(file_get_contents(ENGINE_DIR.'/data/ymaps_config.json'));
+
+include(DLEPlugins::Check(ENGINE_DIR.'/modules/ymaps/language/Russian.lng'));
+
+$key = ($cfg->main->apiKey) ? '&apikey='.$cfg->main->apiKey : '';
+
+$js_array[] = 'engine/modules/ymaps/js/jquery.magnificpopup.min.js';
+$js_array[] = 'templates/'.$config['skin'].'/ymaps/ymaps.js';
+
+$mapHeight = ($cfg->main->mapHeight) ? $cfg->main->mapHeight : '400';
+$controls = (array)$cfg->main->controls;
+$controls = array_keys($controls);
+$controls = json_encode($controls);
+$arPlacemarkStyles = ($cfg->pointSettings->catPoints) ? json_encode($cfg->pointSettings->catPoints) : '{}';
+$mapSelector = 'ymaps-map-container';
+
+$onload_scripts[] = <<main->mapHeight},
+ defaultPos: {
+ lat: '{$cfg->main->mapCenter->latitude}',
+ lon: '{$cfg->main->mapCenter->longitude}',
+ zoom: '{$cfg->main->mapCenter->zoom}',
+ },
+ arPlacemarkStyles: {$arPlacemarkStyles},
+ inputSelector: '[name="xfield[{$cfg->main->coordsField}]"]',
+ xfHolder: '#xfield_holder_{$cfg->main->coordsField}'
+ }
+ if (addNewsMapStart) {
+ addNewsMapStart(mapConfig);
+ };
+HTML;
+
+$ymaps = <<
+
+
+HTML;
+
+
+echo $ymaps;
\ No newline at end of file
diff --git a/upload/engine/modules/ymaps/admin/.htaccess b/engine/modules/ymaps/admin/.htaccess
similarity index 100%
rename from upload/engine/modules/ymaps/admin/.htaccess
rename to engine/modules/ymaps/admin/.htaccess
diff --git a/upload/engine/modules/ymaps/admin/classes/.htaccess b/engine/modules/ymaps/admin/classes/.htaccess
similarity index 100%
rename from upload/engine/modules/ymaps/admin/classes/.htaccess
rename to engine/modules/ymaps/admin/classes/.htaccess
diff --git a/upload/engine/modules/ymaps/admin/classes/xfields.php b/engine/modules/ymaps/admin/classes/xfields.php
similarity index 98%
rename from upload/engine/modules/ymaps/admin/classes/xfields.php
rename to engine/modules/ymaps/admin/classes/xfields.php
index 7008e4b..94eb4af 100644
--- a/upload/engine/modules/ymaps/admin/classes/xfields.php
+++ b/engine/modules/ymaps/admin/classes/xfields.php
@@ -6,7 +6,8 @@
* @link https://git.io/v9irg
*/
if (!defined('DATALIFEENGINE')) {
- die("Go fuck yourself!");
+ header("HTTP/1.1 403 Forbidden");
+ die("Hacking attempt!");
}
/**
diff --git a/upload/engine/modules/ymaps/admin/mapsettings.php b/engine/modules/ymaps/admin/mapsettings.php
similarity index 72%
rename from upload/engine/modules/ymaps/admin/mapsettings.php
rename to engine/modules/ymaps/admin/mapsettings.php
index 7397b20..c3bb3e1 100644
--- a/upload/engine/modules/ymaps/admin/mapsettings.php
+++ b/engine/modules/ymaps/admin/mapsettings.php
@@ -7,7 +7,8 @@
*/
if (!defined('DATALIFEENGINE')) {
- die("Go fuck yourself!");
+ header("HTTP/1.1 403 Forbidden");
+ die("Hacking attempt!");
}
$fullscreenControl_checked = ($cfg->main->controls->fullscreenControl) ? 'checked' : '';
@@ -18,24 +19,6 @@
$trafficControl_checked = ($cfg->main->controls->trafficControl) ? 'checked' : '';
$typeSelector_checked = ($cfg->main->controls->typeSelector) ? 'checked' : '';
$zoomControl_checked = ($cfg->main->controls->zoomControl) ? 'checked' : '';
-/**
- * [getLangsList description]
- *
- * @param string $dir [description]
- *
- * @return [type] [description]
- */
-function getLangsList($dir = '../language') {
- $f = scandir($dir);
- foreach ($f as $file) {
- if (preg_match('/\.(lng)/', $file)) {
- $arr[] = str_replace('.lng', '', $file);
- }
- }
-
- return $arr;
-}
-
?>
@@ -46,48 +29,20 @@ function getLangsList($dir = '../language') {
= $module_lang['mapSettings'] ?>
-
-
-
Выполнение запросов в БД
-
- $installForm
- $uninstallForm
-
-HTML;
-
-
- }
-
- // Если руки пользователя кривые, или он просто забыл перекодировать файлы - скажем ему об этом.
- if ($fileCharset['conflict']) {
- $output = 'Ошибка! Кодировка файла установщика (' . $fileCharset['charset'] . ' ) не совпадает с кодировкой сайта (' . $config['charset'] . ' ). Установка не возможна. Перекодируйте все php файлы модуля и запустите установщик ещё раз.
';
- }
-
- // Функция возвращает то, что должно быть выведено
- return $output;
-}
-
-/**
- * Отлавливаем данные о кодировке файла (utf-8 или windows-1251);
- * @param string $string - строка (или массив), в которой требуется определить кодировку.
- *
- * @return array - возвращает массив с определением конфликта кодировки строки и сайта, а так же сму кодировку строки.
- */
-function chasetConflict($string) {
- global $config;
- if (is_array($string)) {
- $string = implode(' ', $string);
- }
- $detect = preg_match(
- '%(?:
- [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
- |\xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
- |[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
- |\xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
- |\xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
- |[\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
- |\xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
- )+%xs',
- $string
- );
- $stringCharset = ($detect == '1') ? 'utf-8' : 'windows-1251';
- $config['charset'] = strtolower($config['charset']);
- $return = array();
- $return['conflict'] = ($stringCharset == $config['charset']) ? false : true;
- $return['charset'] = $stringCharset;
-
- return $return;
-}
-
-?>
-
-
-
-
- =$cfg['moduleTitle']?>
-
-
-
-
-
-
- =$cfg['moduleTitle']?> v.=$cfg['moduleVersion']?> от =$cfg['moduleDate']?>
-
-
-
-
- Мастер установки модуля =$cfg['moduleTitle']?> для DLE =$cfg['dleVersion']?>
-
-
-
-
-
-
-
-
-
-
-
-
-