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[] = ''; + + } + + 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[] = ''; + } + $optionsCustomIcons = implode("\n", $optionsCustomIcons); + + $customSelect = ($cfg['pointSettings']['catPoints'][$arCat['id']]['iconLayout']) ? 'selected' : ''; + + $showResult = '
+
+ +
+
'; + } else { + $showResult = '
+ +
'; + } + + 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'] ?> + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+ (' + .$user_group[$member_id['user_group']]['group_name'].') ' ?> + +
+
+
+
+
+
+

+ +

+
+
+
+
+
+
+
    +
  • +
  • +
  • +
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+ DLE-YandexMaps
+
+
+
+
+ + 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') {

-
+ -
-
-   -
-
- - -
-
- -
-
- -
-
- - -
- -
-
- -
- -
- +
+ + + +
-
*/ ?> +
@@ -179,24 +134,12 @@ function getLangsList($dir = '../language') { value="main->coordsField ?>" placeholder="">
- -
- -
-
- -
- - */ ?> - -
  diff --git a/upload/engine/modules/ymaps/admin/pointersettings.php b/engine/modules/ymaps/admin/pointersettings.php similarity index 92% rename from upload/engine/modules/ymaps/admin/pointersettings.php rename to engine/modules/ymaps/admin/pointersettings.php index 648715f..f4d4042 100644 --- a/upload/engine/modules/ymaps/admin/pointersettings.php +++ b/engine/modules/ymaps/admin/pointersettings.php @@ -7,7 +7,8 @@ */ if (!defined('DATALIFEENGINE')) { - die("Go fuck yourself!"); + header("HTTP/1.1 403 Forbidden"); + die("Hacking attempt!"); } $icons = json_decode(file_get_contents(ENGINE_DIR . '/data/ymaps_icons.json'), true); @@ -49,11 +50,11 @@ function getCatPointSettings($id) { $arPoint = (array)$cfg->pointSettings->catPoints->$id; $imgName = str_replace(['islands#', 'StretchyIcon'], ['', 'Str'], $arPoint['preset']); if (array_key_exists('iconColor', $arPoint)) { - $strPoint[] = '

'; + $strPoint[] = '

'; } elseif (array_key_exists('iconLayout', $arPoint)) { $strPoint[] = '

'; } else { - $strPoint[] = '

'; + $strPoint[] = '

'; } if (count($arPoint) > 0) { diff --git a/upload/engine/modules/ymaps/admin/support.php b/engine/modules/ymaps/admin/support.php similarity index 79% rename from upload/engine/modules/ymaps/admin/support.php rename to engine/modules/ymaps/admin/support.php index 265b40b..793fa7f 100644 --- a/upload/engine/modules/ymaps/admin/support.php +++ b/engine/modules/ymaps/admin/support.php @@ -7,7 +7,8 @@ */ if (!defined('DATALIFEENGINE')) { - die("Go fuck yourself!"); + header("HTTP/1.1 403 Forbidden"); + die("Hacking attempt!"); } ?> @@ -20,7 +21,7 @@

diff --git a/upload/engine/modules/ymaps/css/.htaccess b/engine/modules/ymaps/css/.htaccess similarity index 100% rename from upload/engine/modules/ymaps/css/.htaccess rename to engine/modules/ymaps/css/.htaccess diff --git a/upload/engine/modules/ymaps/css/style.css b/engine/modules/ymaps/css/style.css similarity index 100% rename from upload/engine/modules/ymaps/css/style.css rename to engine/modules/ymaps/css/style.css diff --git a/upload/engine/modules/ymaps/css/ymaps_editnews.css b/engine/modules/ymaps/css/ymaps_editnews.css similarity index 100% rename from upload/engine/modules/ymaps/css/ymaps_editnews.css rename to engine/modules/ymaps/css/ymaps_editnews.css diff --git a/engine/modules/ymaps/detail.php b/engine/modules/ymaps/detail.php new file mode 100644 index 0000000..2b00263 --- /dev/null +++ b/engine/modules/ymaps/detail.php @@ -0,0 +1,673 @@ + + * @link https://git.io/v9irg + */ + +if (!defined('DATALIFEENGINE')) { + header("HTTP/1.1 403 Forbidden"); + die("Hacking attempt!"); +} + +$cfg = json_decode(file_get_contents(ENGINE_DIR.'/data/ymaps_config.json')); + +include_once(DLEPlugins::Check(ENGINE_DIR.'/modules/ymaps/language/Russian.lng')); + +// Список разрешенных полей, отбираемых из БД. +$existFields = ['title', 'short_story', 'full_story']; + +// Конфиг модуля +$yMapCfg = [ + 'cachePrefix' => !empty($arConf['cachePrefix']) ? $arConf['cachePrefix'] : 'full_'.(int)$_REQUEST['newsid'].'_ym', + 'id' => (!empty($id)) ? (int)$id : false, + 'template' => !empty($template) ? $template : 'ymaps/default', + 'fields' => !empty($fields) ? $fields : '', +]; +$cacheName = md5(implode('_', $yMapCfg)).$config['skin']; +$yMap = false; +$yMap = dle_cache($yMapCfg['cachePrefix'], $cacheName.$config['skin'], true); +if (!$yMap) { + + // Поля, которые отбираются из БД в любом случае + $_queryFields = ['id', 'category', 'xfields', 'approve']; + + // убираем пробелы, на всякий случай + $fields = str_replace(' ', '', $fields); + + // Разбиваем поля на массив + $_fields = explode(',', $fields); + + // Сравниваем со списком разрешенных полей + foreach ($_fields as $key => $field) { + if (!in_array($field, $existFields)) { + // Удаляем лишние поля из массива + unset($_fields[$key]); + } + } + + // Объединяем массивы + $arQueryFields = array_merge($_queryFields, $_fields); + + // И опять разбиваем, для вставки в запрос. + $queryFields = implode(', ', $arQueryFields); + + // API-key + $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); + $controls = json_encode($controls); + + if (file_exists(TEMPLATE_DIR.'/'.$yMapCfg['template'].'.tpl')) { + + $tpl->load_template($yMapCfg['template'].'.tpl'); + + if ($yMapCfg['id'] > 0) { + $row = $db->super_query("SELECT ".$queryFields." FROM ".PREFIX."_post WHERE id = ".$yMapCfg['id']); + + $catPoints = $cfg->pointSettings->catPoints; + $_catId = intval($row['category']); + + $catPoint = ($catPoints->$_catId) ? $_catId : 'default'; + $placemarkStyle = (array)$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]; + } + + $placemarkStyle = json_encode($placemarkStyle); + + $tpl->set('{placemarkStyle}', $placemarkStyle); + + if ($row['date']) { + $row['date'] = strtotime($row['date']); + } + if ($row['short_story']) { + $row['short_story'] = stripslashes($row['short_story']); + } + if ($row['full_story']) { + $row['full_story'] = stripslashes($row['full_story']); + } + + if ($row['category']) { + $my_cat = []; + $my_cat_link = []; + $cat_list = explode(',', $row['category']); + + $config['category_separator'] = ($config['category_separator'] != ',') ? ' ' + .$config['category_separator'] : ', '; + + if (count($cat_list) == 1) { + $my_cat[] = $cat_info[$cat_list[0]]['name']; + $my_cat_link = get_categories($cat_list[0], $config['category_separator']); + } else { + foreach ($cat_list as $element) { + if ($element) { + $my_cat[] = $cat_info[$element]['name']; + if ($config['allow_alt_url']) { + $my_cat_link[] = "{$cat_info[$element]['name']}"; + } else { + $my_cat_link[] + = "{$cat_info[$element]['name']}"; + } + } + } + $my_cat_link = implode("{$config['category_separator']} ", $my_cat_link); + } + $my_cat = implode("{$config['category_separator']} ", $my_cat); + } + + if ($row['title']) { + $row['title'] = strip_tags($row['title']); + } + + $xf = xfieldsdataload($row['xfields']); + + $xfCo_ = html_entity_decode($xf[$cfg->main->coordsField], ENT_COMPAT); + + $xfCoords = json_decode($xfCo_); + + $lon = ($xfCoords->lon) ? $xfCoords->lon : $cfg->main->mapCenter->longitude; + $lat = ($xfCoords->lat) ? $xfCoords->lat : $cfg->main->mapCenter->latitude; + $zoom = ($xfCoords->zoom) ? $xfCoords->zoom : $cfg->main->mapCenter->zoom; + + } else { + die('empty news id'); + } + + $script_yandex = ''; + $script_popup = ''; + $script_module = ''; + + $tpl->set('{key}', $key); + + $tpl->set('{scripts}', $script_yandex.$script_popup.$script_module); + $tpl->set('{script_yandex}', $script_yandex); + $tpl->set('{script_popup}', $script_popup); + $tpl->set('{script_module}', $script_module); + + $tpl->set('{lon}', $lon); + $tpl->set('{lat}', $lat); + $tpl->set('{zoom}', $zoom); + $tpl->set('{mapHeight}', $mapHeight); + $tpl->set('{controls}', $controls); + $tpl->set('{placemarkStyle}', $placemarkStyle); + $tpl->set('{baloon}', ''); + $tpl->set('{id}', $row['id']); + + + // Определяем список тегов, используемых в шаблоне на основании массива с данными о разрешенных полях + foreach ($existFields as $field) { + + if ($row[$field]) { + $tpl->set('{'.$field.'}', $row[$field]); + $tpl->copy_template = preg_replace("'\\[not_".$field."\\](.*?)\\[/not_".$field."\\]'is", "", + $tpl->copy_template); + $tpl->copy_template = str_replace("[".$field."]", "", $tpl->copy_template); + $tpl->copy_template = str_replace("[/".$field."]", "", $tpl->copy_template); + } else { + $tpl->set('{'.$field.'}', ""); + $tpl->copy_template = preg_replace("'\\[".$field."\\](.*?)\\[/".$field."\\]'is", "", + $tpl->copy_template); + $tpl->copy_template = str_replace("[not_".$field."]", "", $tpl->copy_template); + $tpl->copy_template = str_replace("[/not_".$field."]", "", $tpl->copy_template); + } + } + + // Работаем с допполями + if (strpos($tpl->copy_template, "[xfvalue_") !== false OR strpos($tpl->copy_template, "[xfgiven_") !== false) { + + $xfieldsdata = $xf; + $xfields = xfieldsload(); + if (count($xfields)) { + + $xfieldsdata = xfieldsdataload($row['xfields']); + + foreach ($xfields as $value) { + $preg_safe_name = preg_quote($value[0], "'"); + + if ($value[20]) { + + $value[20] = explode(',', $value[20]); + + if ($value[20][0] AND !in_array($member_id['user_group'], $value[20])) { + $xfieldsdata[$value[0]] = ""; + } + + } + + if ($value[3] == "yesorno") { + + if (intval($xfieldsdata[$value[0]])) { + $xfgiven = true; + $xfieldsdata[$value[0]] = $lang['xfield_xyes']; + } else { + $xfgiven = false; + $xfieldsdata[$value[0]] = $lang['xfield_xno']; + } + + } else { + + if ($xfieldsdata[$value[0]] == "") { + $xfgiven = false; + } else { + $xfgiven = true; + } + + } + + if (!$xfgiven) { + $tpl->copy_template + = preg_replace("'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", + "", $tpl->copy_template); + $tpl->copy_template = str_ireplace("[xfnotgiven_{$value[0]}]", "", $tpl->copy_template); + $tpl->copy_template = str_ireplace("[/xfnotgiven_{$value[0]}]", "", $tpl->copy_template); + } else { + $tpl->copy_template + = preg_replace("'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", + "", $tpl->copy_template); + $tpl->copy_template = str_ireplace("[xfgiven_{$value[0]}]", "", $tpl->copy_template); + $tpl->copy_template = str_ireplace("[/xfgiven_{$value[0]}]", "", $tpl->copy_template); + } + + if (strpos($tpl->copy_template, "[ifxfvalue {$value[0]}") !== false) { + $tpl->copy_template = preg_replace_callback("#\\[ifxfvalue(.+?)\\](.+?)\\[/ifxfvalue\\]#is", + "check_xfvalue", $tpl->copy_template); + } + + if ($value[6] AND !empty($xfieldsdata[$value[0]])) { + $temp_array = explode(",", $xfieldsdata[$value[0]]); + $value3 = []; + + foreach ($temp_array as $value2) { + + $value2 = trim($value2); + + if ($value2) { + + $value4 = str_replace(["'", """, "&", "{", "[", ":"], + ["'", '"', "&", "{", "[", ":"], $value2); + + if ($value[3] == "datetime") { + + $value2 = strtotime($value4); + + if (!trim($value[24])) { + $value[24] = $config['timestamp_active']; + } + + if ($value[25]) { + + if ($value[26]) { + $value2 = langdate($value[24], $value2); + } else { + $value2 = langdate($value[24], $value2, false, $customlangdate); + } + + } else { + $value2 = date($value[24], $value2); + } + + } + + if ($config['allow_alt_url']) { + $value3[] = "".$value2.""; + } else { + $value3[] = "".$value2.""; + } + } + + } + + if (empty($value[21])) { + $value[21] = ", "; + } + + $xfieldsdata[$value[0]] = implode($value[21], $value3); + + unset($temp_array); + unset($value2); + unset($value3); + unset($value3); + + } elseif ($value[3] == "datetime" AND !empty($xfieldsdata[$value[0]])) { + + $xfieldsdata[$value[0]] = strtotime(str_replace(":", ":", $xfieldsdata[$value[0]])); + + if (!trim($value[24])) { + $value[24] = $config['timestamp_active']; + } + + if ($value[25]) { + + if ($value[26]) { + $xfieldsdata[$value[0]] = langdate($value[24], $xfieldsdata[$value[0]]); + } else { + $xfieldsdata[$value[0]] = langdate($value[24], $xfieldsdata[$value[0]], false, + $customlangdate); + } + + } else { + $xfieldsdata[$value[0]] = date($value[24], $xfieldsdata[$value[0]]); + } + + + } + + if ($config['allow_links'] AND $value[3] == "textarea" AND function_exists('replace_links')) { + $xfieldsdata[$value[0]] = replace_links($xfieldsdata[$value[0]], $replace_links['news']); + } + + if ($value[3] == "image" AND $xfieldsdata[$value[0]]) { + + $temp_array = explode('|', $xfieldsdata[$value[0]]); + + if (count($temp_array) > 1) { + + $temp_alt = $temp_array[0]; + $temp_value = $temp_array[1]; + + } else { + + $temp_alt = ''; + $temp_value = $temp_array[0]; + + } + + $path_parts = @pathinfo($temp_value); + + if ($value[12] AND file_exists(ROOT_DIR."/uploads/posts/".$path_parts['dirname']."/thumbs/" + .$path_parts['basename']) + ) { + $thumb_url = $config['http_home_url']."uploads/posts/".$path_parts['dirname']."/thumbs/" + .$path_parts['basename']; + $img_url = $config['http_home_url']."uploads/posts/".$path_parts['dirname']."/" + .$path_parts['basename']; + } else { + $img_url = $config['http_home_url']."uploads/posts/".$path_parts['dirname']."/" + .$path_parts['basename']; + $thumb_url = ""; + } + + if ($thumb_url) { + $tpl->set("[xfvalue_thumb_url_{$value[0]}]", $thumb_url); + $xfieldsdata[$value[0]] + = "\"{$temp_alt}\""; + } else { + $tpl->set("[xfvalue_thumb_url_{$value[0]}]", $img_url); + $xfieldsdata[$value[0]] + = "\"{$temp_alt}\""; + } + + $tpl->set("[xfvalue_image_url_{$value[0]}]", $img_url); + + } + + if ($value[3] == "image" AND !$xfieldsdata[$value[0]]) { + + $tpl->set("[xfvalue_thumb_url_{$value[0]}]", ""); + $tpl->set("[xfvalue_image_url_{$value[0]}]", ""); + + } + + if ($value[3] == "imagegalery" AND $xfieldsdata[$value[0]] AND stripos($tpl->copy_template, + "[xfvalue_{$value[0]}") !== false + ) { + + $fieldvalue_arr = explode(',', $xfieldsdata[$value[0]]); + $gallery_image = []; + $gallery_single_image = []; + $xf_image_count = 0; + $single_need = false; + + if (stripos($tpl->copy_template, "[xfvalue_{$value[0]} image=") !== false) { + $single_need = true; + } + + foreach ($fieldvalue_arr as $temp_value) { + $xf_image_count++; + + $temp_value = trim($temp_value); + + if ($temp_value == "") { + continue; + } + + $temp_array = explode('|', $temp_value); + + if (count($temp_array) > 1) { + + $temp_alt = $temp_array[0]; + $temp_value = $temp_array[1]; + + } else { + + $temp_alt = ''; + $temp_value = $temp_array[0]; + + } + + $path_parts = @pathinfo($temp_value); + + if ($value[12] AND file_exists(ROOT_DIR."/uploads/posts/".$path_parts['dirname']."/thumbs/" + .$path_parts['basename']) + ) { + $thumb_url = $config['http_home_url']."uploads/posts/".$path_parts['dirname']."/thumbs/" + .$path_parts['basename']; + $img_url = $config['http_home_url']."uploads/posts/".$path_parts['dirname']."/" + .$path_parts['basename']; + } else { + $img_url = $config['http_home_url']."uploads/posts/".$path_parts['dirname']."/" + .$path_parts['basename']; + $thumb_url = ""; + } + + if ($thumb_url) { + + $gallery_image[] + = "
  • \"{$temp_alt}\"
  • "; + $gallery_single_image['[xfvalue_'.$value[0].' image="'.$xf_image_count.'"]'] + = "\"{$temp_alt}\""; + + } else { + $gallery_image[] = "
  • \"{$temp_alt}\"
  • "; + $gallery_single_image['[xfvalue_'.$value[0].' image="'.$xf_image_count.'"]'] + = "\"{$temp_alt}\""; + } + + } + + if ($single_need AND count($gallery_single_image)) { + foreach ($gallery_single_image as $temp_key => $temp_value) { + $tpl->set($temp_key, $temp_value); + } + } + + $xfieldsdata[$value[0]] = "
      " + .implode($gallery_image)."
    "; + + } + + if ($config['image_lazy'] AND $view_template != "print") { + $xfieldsdata[$value[0]] = preg_replace_callback("##i", "enable_lazyload", + $xfieldsdata[$value[0]]); + } + + $tpl->set("[xfvalue_{$value[0]}]", $xfieldsdata[$value[0]]); + + $all_xf_content[] = $xfieldsdata[$value[0]]; + + if (preg_match("#\\[xfvalue_{$preg_safe_name} limit=['\"](.+?)['\"]\\]#i", $tpl->copy_template, + $matches) + ) { + $count = intval($matches[1]); + + $xfieldsdata[$value[0]] = str_replace("><", "> <", $xfieldsdata[$value[0]]); + $xfieldsdata[$value[0]] = strip_tags($xfieldsdata[$value[0]], "
    "); + $xfieldsdata[$value[0]] = trim(str_replace("
    ", " ", str_replace("
    ", " ", + str_replace("\n", " ", str_replace("\r", "", $xfieldsdata[$value[0]]))))); + $xfieldsdata[$value[0]] = preg_replace('/\s+/u', ' ', $xfieldsdata[$value[0]]); + + if ($count AND dle_strlen($xfieldsdata[$value[0]], $config['charset']) > $count) { + + $xfieldsdata[$value[0]] = dle_substr($xfieldsdata[$value[0]], 0, $count, + $config['charset']); + + if (($temp_dmax = dle_strrpos($xfieldsdata[$value[0]], ' ', $config['charset']))) { + $xfieldsdata[$value[0]] = dle_substr($xfieldsdata[$value[0]], 0, $temp_dmax, + $config['charset']); + } + + } + + $tpl->set($matches[0], $xfieldsdata[$value[0]]); + + } + } + } + } + + if (stripos($tpl->copy_template, "{image-") !== false && in_array('short_story', $arQueryFields)) { + + $images = []; + preg_match_all('/(img|src)=("|\')[^"\'>]+/i', $row['short_story'].$row['xfields'], $media); + $data = preg_replace('/(img|src)("|\'|="|=\')(.*)/i', "$3", $media[0]); + + foreach ($data as $url) { + $info = pathinfo($url); + if (isset($info['extension'])) { + if ($info['filename'] == "spoiler-plus" OR $info['filename'] == "spoiler-minus" + OR strpos($info['dirname'], 'engine/data/emoticons') !== false + ) { + continue; + } + $info['extension'] = strtolower($info['extension']); + if (($info['extension'] == 'jpg') || ($info['extension'] == 'jpeg') || ($info['extension'] == 'gif') + || ($info['extension'] == 'png') + || ($info['extension'] == 'webp') + ) { + array_push($images, $url); + } + } + } + + if (count($images)) { + $i = 0; + foreach ($images as $url) { + $i++; + $tpl->copy_template = str_replace('{image-'.$i.'}', $url, $tpl->copy_template); + $tpl->copy_template = str_replace('[image-'.$i.']', "", $tpl->copy_template); + $tpl->copy_template = str_replace('[/image-'.$i.']', "", $tpl->copy_template); + $tpl->copy_template = preg_replace("#\[not-image-{$i_count}\](.+?)\[/not-image-{$i_count}\]#is", "", + $tpl->copy_template); + } + + } + + $tpl->copy_template = preg_replace("#\[image-(.+?)\](.+?)\[/image-(.+?)\]#is", "", $tpl->copy_template); + $tpl->copy_template = preg_replace("#\\{image-(.+?)\\}#i", "{THEME}/dleimages/no_image.jpg", + $tpl->copy_template); + $tpl->copy_template = preg_replace("#\[not-image-(.+?)\]#i", "", $tpl->copy_template); + $tpl->copy_template = preg_replace("#\[/not-image-(.+?)\]#i", "", $tpl->copy_template); + + } + + if (stripos($tpl->copy_template, "{fullimage-") !== false && in_array('full_story', $arQueryFields)) { + + $images = []; + preg_match_all('/(img|src)=("|\')[^"\'>]+/i', $row['full_story'], $media); + $data = preg_replace('/(img|src)("|\'|="|=\')(.*)/i', "$3", $media[0]); + + foreach ($data as $url) { + $info = pathinfo($url); + if (isset($info['extension'])) { + if ($info['filename'] == "spoiler-plus" OR $info['filename'] == "spoiler-minus" + OR strpos($info['dirname'], 'engine/data/emoticons') !== false + ) { + continue; + } + $info['extension'] = strtolower($info['extension']); + if (($info['extension'] == 'jpg') || ($info['extension'] == 'jpeg') || ($info['extension'] == 'gif') + || ($info['extension'] == 'png') + || ($info['extension'] == 'webp') + ) { + array_push($images, $url); + } + } + } + + if (count($images)) { + $i = 0; + foreach ($images as $url) { + $i++; + $tpl->copy_template = str_replace('{fullimage-'.$i.'}', $url, $tpl->copy_template); + $tpl->copy_template = str_replace('[fullimage-'.$i.']', "", $tpl->copy_template); + $tpl->copy_template = str_replace('[/fullimage-'.$i.']', "", $tpl->copy_template); + } + + } + + $tpl->copy_template = preg_replace("#\[fullimage-(.+?)\](.+?)\[/fullimage-(.+?)\]#is", "", + $tpl->copy_template); + $tpl->copy_template = preg_replace("#\\{fullimage-(.+?)\\}#i", "{THEME}/dleimages/no_image.jpg", + $tpl->copy_template); + + } + + $images = []; + $allcontent = $row['full_story'].$row['short_story'].$row['xfields']; + preg_match_all('/(img|src)=("|\')[^"\'>]+/i', $allcontent, $media); + $data = preg_replace('/(img|src)("|\'|="|=\')(.*)/i', "$3", $media[0]); + + foreach ($data as $url) { + $info = pathinfo($url); + if (isset($info['extension'])) { + if ($info['filename'] == "spoiler-plus" OR $info['filename'] == "spoiler-minus" + OR strpos($info['dirname'], 'engine/data/emoticons') !== false + ) { + continue; + } + $info['extension'] = strtolower($info['extension']); + if (($info['extension'] == 'jpg' || $info['extension'] == 'jpeg' || $info['extension'] == 'gif' + || $info['extension'] == 'png' + || $info['extension'] == 'webp') AND !in_array($url, $images) + ) { + array_push($images, $url); + } + } + } + + if (in_array('title', $arQueryFields)) { + if (preg_match("#\\{title limit=['\"](.+?)['\"]\\}#i", $tpl->copy_template, $matches)) { + $count = intval($matches[1]); + if ($count AND dle_strlen($row['title'], $config['charset']) > $count) { + $row['title'] = dle_substr($row['title'], 0, $count, $config['charset']); + if (($temp_dmax = dle_strrpos($row['title'], ' ', $config['charset']))) { + $row['title'] = dle_substr($row['title'], 0, $temp_dmax, $config['charset']); + } + } + $tpl->set($matches[0], $row['title']); + } + } + + if (in_array('short_story', $arQueryFields)) { + if (preg_match("#\\{short_story limit=['\"](.+?)['\"]\\}#i", $tpl->copy_template, $matches)) { + $count = intval($matches[1]); + $row['short_story'] = str_replace("

    ", " ", $row['short_story']); + $row['short_story'] = strip_tags($row['short_story'], "
    "); + $row['short_story'] = trim(str_replace("
    ", " ", + str_replace("
    ", " ", str_replace("\n", " ", str_replace("\r", "", $row['short_story']))))); + if ($count AND dle_strlen($row['short_story'], $config['charset']) > $count) { + $row['short_story'] = dle_substr($row['short_story'], 0, $count, $config['charset']); + if (($temp_dmax = dle_strrpos($row['short_story'], ' ', $config['charset']))) { + $row['short_story'] = dle_substr($row['short_story'], 0, $temp_dmax, $config['charset']); + } + } + $tpl->set($matches[0], $row['short_story']); + } + } + + if (in_array('full_story', $arQueryFields)) { + if (preg_match("#\\{full_story limit=['\"](.+?)['\"]\\}#i", $tpl->copy_template, $matches)) { + $count = intval($matches[1]); + $row['full_story'] = str_replace("

    ", " ", $row['full_story']); + $row['full_story'] = strip_tags($row['full_story'], "
    "); + $row['full_story'] = trim(str_replace("
    ", " ", + str_replace("
    ", " ", str_replace("\n", " ", str_replace("\r", "", $row['full_story']))))); + if ($count AND dle_strlen($row['full_story'], $config['charset']) > $count) { + $row['full_story'] = dle_substr($row['full_story'], 0, $count, $config['charset']); + if (($temp_dmax = dle_strrpos($row['full_story'], ' ', $config['charset']))) { + $row['full_story'] = dle_substr($row['full_story'], 0, $temp_dmax, $config['charset']); + } + } + $tpl->set($matches[0], $row['full_story']); + + } + } + + $tpl->compile('yMap'); + $yMap = $tpl->result['yMap']; + + create_cache($yMapCfg['cachePrefix'], $yMap, $cacheName.$config['skin'], true); + + $tpl->clear(); + } else { + $yMap = ''.$module_lang['moduleTextMissedTemplateFile'].': '.$config['skin'].'/' + .$yMapCfg['template'].'.tpl'; + } + + +} +echo $yMap; \ No newline at end of file diff --git a/upload/engine/modules/ymaps/images/.htaccess b/engine/modules/ymaps/images/.htaccess similarity index 100% rename from upload/engine/modules/ymaps/images/.htaccess rename to engine/modules/ymaps/images/.htaccess diff --git a/upload/engine/modules/ymaps/images/black.png b/engine/modules/ymaps/images/black.png similarity index 100% rename from upload/engine/modules/ymaps/images/black.png rename to engine/modules/ymaps/images/black.png diff --git a/upload/engine/modules/ymaps/images/blackCircleDotIcon.png b/engine/modules/ymaps/images/blackCircleDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/blackCircleDotIcon.png rename to engine/modules/ymaps/images/blackCircleDotIcon.png diff --git a/upload/engine/modules/ymaps/images/blackCircleIcon.png b/engine/modules/ymaps/images/blackCircleIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/blackCircleIcon.png rename to engine/modules/ymaps/images/blackCircleIcon.png diff --git a/upload/engine/modules/ymaps/images/blackDotIcon.png b/engine/modules/ymaps/images/blackDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/blackDotIcon.png rename to engine/modules/ymaps/images/blackDotIcon.png diff --git a/upload/engine/modules/ymaps/images/blackIcon.png b/engine/modules/ymaps/images/blackIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/blackIcon.png rename to engine/modules/ymaps/images/blackIcon.png diff --git a/upload/engine/modules/ymaps/images/blackInverted.png b/engine/modules/ymaps/images/blackInverted.png similarity index 100% rename from upload/engine/modules/ymaps/images/blackInverted.png rename to engine/modules/ymaps/images/blackInverted.png diff --git a/upload/engine/modules/ymaps/images/blackStr.png b/engine/modules/ymaps/images/blackStr.png similarity index 100% rename from upload/engine/modules/ymaps/images/blackStr.png rename to engine/modules/ymaps/images/blackStr.png diff --git a/upload/engine/modules/ymaps/images/blue.png b/engine/modules/ymaps/images/blue.png similarity index 100% rename from upload/engine/modules/ymaps/images/blue.png rename to engine/modules/ymaps/images/blue.png diff --git a/upload/engine/modules/ymaps/images/blueCircleDotIcon.png b/engine/modules/ymaps/images/blueCircleDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/blueCircleDotIcon.png rename to engine/modules/ymaps/images/blueCircleDotIcon.png diff --git a/upload/engine/modules/ymaps/images/blueCircleIcon.png b/engine/modules/ymaps/images/blueCircleIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/blueCircleIcon.png rename to engine/modules/ymaps/images/blueCircleIcon.png diff --git a/upload/engine/modules/ymaps/images/blueDotIcon.png b/engine/modules/ymaps/images/blueDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/blueDotIcon.png rename to engine/modules/ymaps/images/blueDotIcon.png diff --git a/upload/engine/modules/ymaps/images/blueIcon.png b/engine/modules/ymaps/images/blueIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/blueIcon.png rename to engine/modules/ymaps/images/blueIcon.png diff --git a/upload/engine/modules/ymaps/images/blueInverted.png b/engine/modules/ymaps/images/blueInverted.png similarity index 100% rename from upload/engine/modules/ymaps/images/blueInverted.png rename to engine/modules/ymaps/images/blueInverted.png diff --git a/upload/engine/modules/ymaps/images/blueStr.png b/engine/modules/ymaps/images/blueStr.png similarity index 100% rename from upload/engine/modules/ymaps/images/blueStr.png rename to engine/modules/ymaps/images/blueStr.png diff --git a/upload/engine/modules/ymaps/images/brown.png b/engine/modules/ymaps/images/brown.png similarity index 100% rename from upload/engine/modules/ymaps/images/brown.png rename to engine/modules/ymaps/images/brown.png diff --git a/upload/engine/modules/ymaps/images/brownCircleDotIcon.png b/engine/modules/ymaps/images/brownCircleDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/brownCircleDotIcon.png rename to engine/modules/ymaps/images/brownCircleDotIcon.png diff --git a/upload/engine/modules/ymaps/images/brownCircleIcon.png b/engine/modules/ymaps/images/brownCircleIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/brownCircleIcon.png rename to engine/modules/ymaps/images/brownCircleIcon.png diff --git a/upload/engine/modules/ymaps/images/brownDotIcon.png b/engine/modules/ymaps/images/brownDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/brownDotIcon.png rename to engine/modules/ymaps/images/brownDotIcon.png diff --git a/upload/engine/modules/ymaps/images/brownIcon.png b/engine/modules/ymaps/images/brownIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/brownIcon.png rename to engine/modules/ymaps/images/brownIcon.png diff --git a/upload/engine/modules/ymaps/images/brownInverted.png b/engine/modules/ymaps/images/brownInverted.png similarity index 100% rename from upload/engine/modules/ymaps/images/brownInverted.png rename to engine/modules/ymaps/images/brownInverted.png diff --git a/upload/engine/modules/ymaps/images/brownStr.png b/engine/modules/ymaps/images/brownStr.png similarity index 100% rename from upload/engine/modules/ymaps/images/brownStr.png rename to engine/modules/ymaps/images/brownStr.png diff --git a/upload/engine/modules/ymaps/images/circleDotIcon.png b/engine/modules/ymaps/images/circleDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/circleDotIcon.png rename to engine/modules/ymaps/images/circleDotIcon.png diff --git a/upload/engine/modules/ymaps/images/circleIcon.png b/engine/modules/ymaps/images/circleIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/circleIcon.png rename to engine/modules/ymaps/images/circleIcon.png diff --git a/upload/engine/modules/ymaps/images/cluster.png b/engine/modules/ymaps/images/cluster.png similarity index 100% rename from upload/engine/modules/ymaps/images/cluster.png rename to engine/modules/ymaps/images/cluster.png diff --git a/upload/engine/modules/ymaps/images/darkBlue.png b/engine/modules/ymaps/images/darkBlue.png similarity index 100% rename from upload/engine/modules/ymaps/images/darkBlue.png rename to engine/modules/ymaps/images/darkBlue.png diff --git a/upload/engine/modules/ymaps/images/darkBlueCircleDotIcon.png b/engine/modules/ymaps/images/darkBlueCircleDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/darkBlueCircleDotIcon.png rename to engine/modules/ymaps/images/darkBlueCircleDotIcon.png diff --git a/upload/engine/modules/ymaps/images/darkBlueCircleIcon.png b/engine/modules/ymaps/images/darkBlueCircleIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/darkBlueCircleIcon.png rename to engine/modules/ymaps/images/darkBlueCircleIcon.png diff --git a/upload/engine/modules/ymaps/images/darkBlueDotIcon.png b/engine/modules/ymaps/images/darkBlueDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/darkBlueDotIcon.png rename to engine/modules/ymaps/images/darkBlueDotIcon.png diff --git a/upload/engine/modules/ymaps/images/darkBlueIcon.png b/engine/modules/ymaps/images/darkBlueIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/darkBlueIcon.png rename to engine/modules/ymaps/images/darkBlueIcon.png diff --git a/upload/engine/modules/ymaps/images/darkBlueInverted.png b/engine/modules/ymaps/images/darkBlueInverted.png similarity index 100% rename from upload/engine/modules/ymaps/images/darkBlueInverted.png rename to engine/modules/ymaps/images/darkBlueInverted.png diff --git a/upload/engine/modules/ymaps/images/darkBlueStr.png b/engine/modules/ymaps/images/darkBlueStr.png similarity index 100% rename from upload/engine/modules/ymaps/images/darkBlueStr.png rename to engine/modules/ymaps/images/darkBlueStr.png diff --git a/upload/engine/modules/ymaps/images/darkGreen.png b/engine/modules/ymaps/images/darkGreen.png similarity index 100% rename from upload/engine/modules/ymaps/images/darkGreen.png rename to engine/modules/ymaps/images/darkGreen.png diff --git a/upload/engine/modules/ymaps/images/darkGreenCircleDotIcon.png b/engine/modules/ymaps/images/darkGreenCircleDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/darkGreenCircleDotIcon.png rename to engine/modules/ymaps/images/darkGreenCircleDotIcon.png diff --git a/upload/engine/modules/ymaps/images/darkGreenCircleIcon.png b/engine/modules/ymaps/images/darkGreenCircleIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/darkGreenCircleIcon.png rename to engine/modules/ymaps/images/darkGreenCircleIcon.png diff --git a/upload/engine/modules/ymaps/images/darkGreenDotIcon.png b/engine/modules/ymaps/images/darkGreenDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/darkGreenDotIcon.png rename to engine/modules/ymaps/images/darkGreenDotIcon.png diff --git a/upload/engine/modules/ymaps/images/darkGreenIcon.png b/engine/modules/ymaps/images/darkGreenIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/darkGreenIcon.png rename to engine/modules/ymaps/images/darkGreenIcon.png diff --git a/upload/engine/modules/ymaps/images/darkGreenInverted.png b/engine/modules/ymaps/images/darkGreenInverted.png similarity index 100% rename from upload/engine/modules/ymaps/images/darkGreenInverted.png rename to engine/modules/ymaps/images/darkGreenInverted.png diff --git a/upload/engine/modules/ymaps/images/darkGreenStr.png b/engine/modules/ymaps/images/darkGreenStr.png similarity index 100% rename from upload/engine/modules/ymaps/images/darkGreenStr.png rename to engine/modules/ymaps/images/darkGreenStr.png diff --git a/upload/engine/modules/ymaps/images/darkOrange.png b/engine/modules/ymaps/images/darkOrange.png similarity index 100% rename from upload/engine/modules/ymaps/images/darkOrange.png rename to engine/modules/ymaps/images/darkOrange.png diff --git a/upload/engine/modules/ymaps/images/darkOrangeCircleDotIcon.png b/engine/modules/ymaps/images/darkOrangeCircleDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/darkOrangeCircleDotIcon.png rename to engine/modules/ymaps/images/darkOrangeCircleDotIcon.png diff --git a/upload/engine/modules/ymaps/images/darkOrangeCircleIcon.png b/engine/modules/ymaps/images/darkOrangeCircleIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/darkOrangeCircleIcon.png rename to engine/modules/ymaps/images/darkOrangeCircleIcon.png diff --git a/upload/engine/modules/ymaps/images/darkOrangeDotIcon.png b/engine/modules/ymaps/images/darkOrangeDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/darkOrangeDotIcon.png rename to engine/modules/ymaps/images/darkOrangeDotIcon.png diff --git a/upload/engine/modules/ymaps/images/darkOrangeIcon.png b/engine/modules/ymaps/images/darkOrangeIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/darkOrangeIcon.png rename to engine/modules/ymaps/images/darkOrangeIcon.png diff --git a/upload/engine/modules/ymaps/images/darkOrangeInverted.png b/engine/modules/ymaps/images/darkOrangeInverted.png similarity index 100% rename from upload/engine/modules/ymaps/images/darkOrangeInverted.png rename to engine/modules/ymaps/images/darkOrangeInverted.png diff --git a/upload/engine/modules/ymaps/images/darkOrangeStr.png b/engine/modules/ymaps/images/darkOrangeStr.png similarity index 100% rename from upload/engine/modules/ymaps/images/darkOrangeStr.png rename to engine/modules/ymaps/images/darkOrangeStr.png diff --git a/upload/engine/modules/ymaps/images/dotIcon.png b/engine/modules/ymaps/images/dotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/dotIcon.png rename to engine/modules/ymaps/images/dotIcon.png diff --git a/upload/engine/modules/ymaps/images/geolocation.png b/engine/modules/ymaps/images/geolocation.png similarity index 100% rename from upload/engine/modules/ymaps/images/geolocation.png rename to engine/modules/ymaps/images/geolocation.png diff --git a/upload/engine/modules/ymaps/images/gray.png b/engine/modules/ymaps/images/gray.png similarity index 100% rename from upload/engine/modules/ymaps/images/gray.png rename to engine/modules/ymaps/images/gray.png diff --git a/upload/engine/modules/ymaps/images/grayCircleDotIcon.png b/engine/modules/ymaps/images/grayCircleDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/grayCircleDotIcon.png rename to engine/modules/ymaps/images/grayCircleDotIcon.png diff --git a/upload/engine/modules/ymaps/images/grayCircleIcon.png b/engine/modules/ymaps/images/grayCircleIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/grayCircleIcon.png rename to engine/modules/ymaps/images/grayCircleIcon.png diff --git a/upload/engine/modules/ymaps/images/grayDotIcon.png b/engine/modules/ymaps/images/grayDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/grayDotIcon.png rename to engine/modules/ymaps/images/grayDotIcon.png diff --git a/upload/engine/modules/ymaps/images/grayIcon.png b/engine/modules/ymaps/images/grayIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/grayIcon.png rename to engine/modules/ymaps/images/grayIcon.png diff --git a/upload/engine/modules/ymaps/images/grayInverted.png b/engine/modules/ymaps/images/grayInverted.png similarity index 100% rename from upload/engine/modules/ymaps/images/grayInverted.png rename to engine/modules/ymaps/images/grayInverted.png diff --git a/upload/engine/modules/ymaps/images/grayStr.png b/engine/modules/ymaps/images/grayStr.png similarity index 100% rename from upload/engine/modules/ymaps/images/grayStr.png rename to engine/modules/ymaps/images/grayStr.png diff --git a/upload/engine/modules/ymaps/images/green.png b/engine/modules/ymaps/images/green.png similarity index 100% rename from upload/engine/modules/ymaps/images/green.png rename to engine/modules/ymaps/images/green.png diff --git a/upload/engine/modules/ymaps/images/greenCircleDotIcon.png b/engine/modules/ymaps/images/greenCircleDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/greenCircleDotIcon.png rename to engine/modules/ymaps/images/greenCircleDotIcon.png diff --git a/upload/engine/modules/ymaps/images/greenCircleIcon.png b/engine/modules/ymaps/images/greenCircleIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/greenCircleIcon.png rename to engine/modules/ymaps/images/greenCircleIcon.png diff --git a/upload/engine/modules/ymaps/images/greenDotIcon.png b/engine/modules/ymaps/images/greenDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/greenDotIcon.png rename to engine/modules/ymaps/images/greenDotIcon.png diff --git a/upload/engine/modules/ymaps/images/greenIcon.png b/engine/modules/ymaps/images/greenIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/greenIcon.png rename to engine/modules/ymaps/images/greenIcon.png diff --git a/upload/engine/modules/ymaps/images/greenInverted.png b/engine/modules/ymaps/images/greenInverted.png similarity index 100% rename from upload/engine/modules/ymaps/images/greenInverted.png rename to engine/modules/ymaps/images/greenInverted.png diff --git a/upload/engine/modules/ymaps/images/greenStr.png b/engine/modules/ymaps/images/greenStr.png similarity index 100% rename from upload/engine/modules/ymaps/images/greenStr.png rename to engine/modules/ymaps/images/greenStr.png diff --git a/upload/engine/modules/ymaps/images/icon.png b/engine/modules/ymaps/images/icon.png similarity index 100% rename from upload/engine/modules/ymaps/images/icon.png rename to engine/modules/ymaps/images/icon.png diff --git a/upload/engine/modules/ymaps/images/inverted.png b/engine/modules/ymaps/images/inverted.png similarity index 100% rename from upload/engine/modules/ymaps/images/inverted.png rename to engine/modules/ymaps/images/inverted.png diff --git a/upload/engine/modules/ymaps/images/lightBlue.png b/engine/modules/ymaps/images/lightBlue.png similarity index 100% rename from upload/engine/modules/ymaps/images/lightBlue.png rename to engine/modules/ymaps/images/lightBlue.png diff --git a/upload/engine/modules/ymaps/images/lightBlueCircleDotIcon.png b/engine/modules/ymaps/images/lightBlueCircleDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/lightBlueCircleDotIcon.png rename to engine/modules/ymaps/images/lightBlueCircleDotIcon.png diff --git a/upload/engine/modules/ymaps/images/lightBlueCircleIcon.png b/engine/modules/ymaps/images/lightBlueCircleIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/lightBlueCircleIcon.png rename to engine/modules/ymaps/images/lightBlueCircleIcon.png diff --git a/upload/engine/modules/ymaps/images/lightBlueDotIcon.png b/engine/modules/ymaps/images/lightBlueDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/lightBlueDotIcon.png rename to engine/modules/ymaps/images/lightBlueDotIcon.png diff --git a/upload/engine/modules/ymaps/images/lightBlueIcon.png b/engine/modules/ymaps/images/lightBlueIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/lightBlueIcon.png rename to engine/modules/ymaps/images/lightBlueIcon.png diff --git a/upload/engine/modules/ymaps/images/lightBlueInverted.png b/engine/modules/ymaps/images/lightBlueInverted.png similarity index 100% rename from upload/engine/modules/ymaps/images/lightBlueInverted.png rename to engine/modules/ymaps/images/lightBlueInverted.png diff --git a/upload/engine/modules/ymaps/images/lightBlueStr.png b/engine/modules/ymaps/images/lightBlueStr.png similarity index 100% rename from upload/engine/modules/ymaps/images/lightBlueStr.png rename to engine/modules/ymaps/images/lightBlueStr.png diff --git a/upload/engine/modules/ymaps/images/night.png b/engine/modules/ymaps/images/night.png similarity index 100% rename from upload/engine/modules/ymaps/images/night.png rename to engine/modules/ymaps/images/night.png diff --git a/upload/engine/modules/ymaps/images/nightCircleDotIcon.png b/engine/modules/ymaps/images/nightCircleDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/nightCircleDotIcon.png rename to engine/modules/ymaps/images/nightCircleDotIcon.png diff --git a/upload/engine/modules/ymaps/images/nightCircleIcon.png b/engine/modules/ymaps/images/nightCircleIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/nightCircleIcon.png rename to engine/modules/ymaps/images/nightCircleIcon.png diff --git a/upload/engine/modules/ymaps/images/nightDotIcon.png b/engine/modules/ymaps/images/nightDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/nightDotIcon.png rename to engine/modules/ymaps/images/nightDotIcon.png diff --git a/upload/engine/modules/ymaps/images/nightIcon.png b/engine/modules/ymaps/images/nightIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/nightIcon.png rename to engine/modules/ymaps/images/nightIcon.png diff --git a/upload/engine/modules/ymaps/images/nightInverted.png b/engine/modules/ymaps/images/nightInverted.png similarity index 100% rename from upload/engine/modules/ymaps/images/nightInverted.png rename to engine/modules/ymaps/images/nightInverted.png diff --git a/upload/engine/modules/ymaps/images/nightStr.png b/engine/modules/ymaps/images/nightStr.png similarity index 100% rename from upload/engine/modules/ymaps/images/nightStr.png rename to engine/modules/ymaps/images/nightStr.png diff --git a/upload/engine/modules/ymaps/images/olive.png b/engine/modules/ymaps/images/olive.png similarity index 100% rename from upload/engine/modules/ymaps/images/olive.png rename to engine/modules/ymaps/images/olive.png diff --git a/upload/engine/modules/ymaps/images/oliveCircleDotIcon.png b/engine/modules/ymaps/images/oliveCircleDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/oliveCircleDotIcon.png rename to engine/modules/ymaps/images/oliveCircleDotIcon.png diff --git a/upload/engine/modules/ymaps/images/oliveCircleIcon.png b/engine/modules/ymaps/images/oliveCircleIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/oliveCircleIcon.png rename to engine/modules/ymaps/images/oliveCircleIcon.png diff --git a/upload/engine/modules/ymaps/images/oliveDotIcon.png b/engine/modules/ymaps/images/oliveDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/oliveDotIcon.png rename to engine/modules/ymaps/images/oliveDotIcon.png diff --git a/upload/engine/modules/ymaps/images/oliveIcon.png b/engine/modules/ymaps/images/oliveIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/oliveIcon.png rename to engine/modules/ymaps/images/oliveIcon.png diff --git a/upload/engine/modules/ymaps/images/oliveInverted.png b/engine/modules/ymaps/images/oliveInverted.png similarity index 100% rename from upload/engine/modules/ymaps/images/oliveInverted.png rename to engine/modules/ymaps/images/oliveInverted.png diff --git a/upload/engine/modules/ymaps/images/oliveStr.png b/engine/modules/ymaps/images/oliveStr.png similarity index 100% rename from upload/engine/modules/ymaps/images/oliveStr.png rename to engine/modules/ymaps/images/oliveStr.png diff --git a/upload/engine/modules/ymaps/images/orange.png b/engine/modules/ymaps/images/orange.png similarity index 100% rename from upload/engine/modules/ymaps/images/orange.png rename to engine/modules/ymaps/images/orange.png diff --git a/upload/engine/modules/ymaps/images/orangeCircleDotIcon.png b/engine/modules/ymaps/images/orangeCircleDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/orangeCircleDotIcon.png rename to engine/modules/ymaps/images/orangeCircleDotIcon.png diff --git a/upload/engine/modules/ymaps/images/orangeCircleIcon.png b/engine/modules/ymaps/images/orangeCircleIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/orangeCircleIcon.png rename to engine/modules/ymaps/images/orangeCircleIcon.png diff --git a/upload/engine/modules/ymaps/images/orangeDotIcon.png b/engine/modules/ymaps/images/orangeDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/orangeDotIcon.png rename to engine/modules/ymaps/images/orangeDotIcon.png diff --git a/upload/engine/modules/ymaps/images/orangeIcon.png b/engine/modules/ymaps/images/orangeIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/orangeIcon.png rename to engine/modules/ymaps/images/orangeIcon.png diff --git a/upload/engine/modules/ymaps/images/orangeInverted.png b/engine/modules/ymaps/images/orangeInverted.png similarity index 100% rename from upload/engine/modules/ymaps/images/orangeInverted.png rename to engine/modules/ymaps/images/orangeInverted.png diff --git a/upload/engine/modules/ymaps/images/orangeStr.png b/engine/modules/ymaps/images/orangeStr.png similarity index 100% rename from upload/engine/modules/ymaps/images/orangeStr.png rename to engine/modules/ymaps/images/orangeStr.png diff --git a/upload/engine/modules/ymaps/images/pink.png b/engine/modules/ymaps/images/pink.png similarity index 100% rename from upload/engine/modules/ymaps/images/pink.png rename to engine/modules/ymaps/images/pink.png diff --git a/upload/engine/modules/ymaps/images/pinkCircleDotIcon.png b/engine/modules/ymaps/images/pinkCircleDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/pinkCircleDotIcon.png rename to engine/modules/ymaps/images/pinkCircleDotIcon.png diff --git a/upload/engine/modules/ymaps/images/pinkCircleIcon.png b/engine/modules/ymaps/images/pinkCircleIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/pinkCircleIcon.png rename to engine/modules/ymaps/images/pinkCircleIcon.png diff --git a/upload/engine/modules/ymaps/images/pinkDotIcon.png b/engine/modules/ymaps/images/pinkDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/pinkDotIcon.png rename to engine/modules/ymaps/images/pinkDotIcon.png diff --git a/upload/engine/modules/ymaps/images/pinkIcon.png b/engine/modules/ymaps/images/pinkIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/pinkIcon.png rename to engine/modules/ymaps/images/pinkIcon.png diff --git a/upload/engine/modules/ymaps/images/pinkInverted.png b/engine/modules/ymaps/images/pinkInverted.png similarity index 100% rename from upload/engine/modules/ymaps/images/pinkInverted.png rename to engine/modules/ymaps/images/pinkInverted.png diff --git a/upload/engine/modules/ymaps/images/pinkStr.png b/engine/modules/ymaps/images/pinkStr.png similarity index 100% rename from upload/engine/modules/ymaps/images/pinkStr.png rename to engine/modules/ymaps/images/pinkStr.png diff --git a/upload/engine/modules/ymaps/images/red.png b/engine/modules/ymaps/images/red.png similarity index 100% rename from upload/engine/modules/ymaps/images/red.png rename to engine/modules/ymaps/images/red.png diff --git a/upload/engine/modules/ymaps/images/redCircleDotIcon.png b/engine/modules/ymaps/images/redCircleDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/redCircleDotIcon.png rename to engine/modules/ymaps/images/redCircleDotIcon.png diff --git a/upload/engine/modules/ymaps/images/redCircleIcon.png b/engine/modules/ymaps/images/redCircleIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/redCircleIcon.png rename to engine/modules/ymaps/images/redCircleIcon.png diff --git a/upload/engine/modules/ymaps/images/redDotIcon.png b/engine/modules/ymaps/images/redDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/redDotIcon.png rename to engine/modules/ymaps/images/redDotIcon.png diff --git a/upload/engine/modules/ymaps/images/redIcon.png b/engine/modules/ymaps/images/redIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/redIcon.png rename to engine/modules/ymaps/images/redIcon.png diff --git a/upload/engine/modules/ymaps/images/redInverted.png b/engine/modules/ymaps/images/redInverted.png similarity index 100% rename from upload/engine/modules/ymaps/images/redInverted.png rename to engine/modules/ymaps/images/redInverted.png diff --git a/upload/engine/modules/ymaps/images/redStr.png b/engine/modules/ymaps/images/redStr.png similarity index 100% rename from upload/engine/modules/ymaps/images/redStr.png rename to engine/modules/ymaps/images/redStr.png diff --git a/upload/engine/modules/ymaps/images/violet.png b/engine/modules/ymaps/images/violet.png similarity index 100% rename from upload/engine/modules/ymaps/images/violet.png rename to engine/modules/ymaps/images/violet.png diff --git a/upload/engine/modules/ymaps/images/violetCircleDotIcon.png b/engine/modules/ymaps/images/violetCircleDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/violetCircleDotIcon.png rename to engine/modules/ymaps/images/violetCircleDotIcon.png diff --git a/upload/engine/modules/ymaps/images/violetCircleIcon.png b/engine/modules/ymaps/images/violetCircleIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/violetCircleIcon.png rename to engine/modules/ymaps/images/violetCircleIcon.png diff --git a/upload/engine/modules/ymaps/images/violetDotIcon.png b/engine/modules/ymaps/images/violetDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/violetDotIcon.png rename to engine/modules/ymaps/images/violetDotIcon.png diff --git a/upload/engine/modules/ymaps/images/violetIcon.png b/engine/modules/ymaps/images/violetIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/violetIcon.png rename to engine/modules/ymaps/images/violetIcon.png diff --git a/upload/engine/modules/ymaps/images/violetInverted.png b/engine/modules/ymaps/images/violetInverted.png similarity index 100% rename from upload/engine/modules/ymaps/images/violetInverted.png rename to engine/modules/ymaps/images/violetInverted.png diff --git a/upload/engine/modules/ymaps/images/violetStr.png b/engine/modules/ymaps/images/violetStr.png similarity index 100% rename from upload/engine/modules/ymaps/images/violetStr.png rename to engine/modules/ymaps/images/violetStr.png diff --git a/upload/engine/modules/ymaps/images/yellow.png b/engine/modules/ymaps/images/yellow.png similarity index 100% rename from upload/engine/modules/ymaps/images/yellow.png rename to engine/modules/ymaps/images/yellow.png diff --git a/upload/engine/modules/ymaps/images/yellowCircleDotIcon.png b/engine/modules/ymaps/images/yellowCircleDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/yellowCircleDotIcon.png rename to engine/modules/ymaps/images/yellowCircleDotIcon.png diff --git a/upload/engine/modules/ymaps/images/yellowCircleIcon.png b/engine/modules/ymaps/images/yellowCircleIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/yellowCircleIcon.png rename to engine/modules/ymaps/images/yellowCircleIcon.png diff --git a/upload/engine/modules/ymaps/images/yellowDotIcon.png b/engine/modules/ymaps/images/yellowDotIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/yellowDotIcon.png rename to engine/modules/ymaps/images/yellowDotIcon.png diff --git a/upload/engine/modules/ymaps/images/yellowIcon.png b/engine/modules/ymaps/images/yellowIcon.png similarity index 100% rename from upload/engine/modules/ymaps/images/yellowIcon.png rename to engine/modules/ymaps/images/yellowIcon.png diff --git a/upload/engine/modules/ymaps/images/yellowInverted.png b/engine/modules/ymaps/images/yellowInverted.png similarity index 100% rename from upload/engine/modules/ymaps/images/yellowInverted.png rename to engine/modules/ymaps/images/yellowInverted.png diff --git a/upload/engine/modules/ymaps/images/yellowStr.png b/engine/modules/ymaps/images/yellowStr.png similarity index 100% rename from upload/engine/modules/ymaps/images/yellowStr.png rename to engine/modules/ymaps/images/yellowStr.png diff --git a/upload/engine/modules/ymaps/js/.htaccess b/engine/modules/ymaps/js/.htaccess similarity index 100% rename from upload/engine/modules/ymaps/js/.htaccess rename to engine/modules/ymaps/js/.htaccess diff --git a/engine/modules/ymaps/js/jquery-3.4.1.min.js b/engine/modules/ymaps/js/jquery-3.4.1.min.js new file mode 100644 index 0000000..a1c07fd --- /dev/null +++ b/engine/modules/ymaps/js/jquery-3.4.1.min.js @@ -0,0 +1,2 @@ +/*! jQuery v3.4.1 | (c) JS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],E=C.document,r=Object.getPrototypeOf,s=t.slice,g=t.concat,u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.4.1",k=function(e,t){return new k.fn.init(e,t)},p=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function d(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp($),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+$),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ne=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(m.childNodes),m.childNodes),t[m.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&((e?e.ownerDocument||e:m)!==C&&T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!A[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&U.test(t)){(s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=k),o=(l=h(t)).length;while(o--)l[o]="#"+s+" "+xe(l[o]);c=l.join(","),f=ee.test(t)&&ye(e.parentNode)||e}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){A(t,!0)}finally{s===k&&e.removeAttribute("id")}}}return g(t.replace(B,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[k]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:m;return r!==C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),m!==C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=k,!C.getElementsByName||!C.getElementsByName(k).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+k+"-]").length||v.push("~="),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+k+"+*").length||v.push(".#.+[+~]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",$)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e===C||e.ownerDocument===m&&y(m,e)?-1:t===C||t.ownerDocument===m&&y(m,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===C?-1:t===C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]===m?-1:s[r]===m?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if((e.ownerDocument||e)!==C&&T(e),d.matchesSelector&&E&&!A[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){A(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=p[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&p(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?k.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?k.grep(e,function(e){return e===n!==r}):"string"!=typeof n?k.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(k.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:L.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof k?t[0]:t,k.merge(this,k.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),D.test(r[1])&&k.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(k):k.makeArray(e,this)}).prototype=k.fn,q=k(E);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}k.fn.extend({has:function(e){var t=k(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,""],thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?k.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;nx",y.noCloneChecked=!!me.cloneNode(!0).lastChild.defaultValue;var Te=/^key/,Ce=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ee=/^([^.]*)(?:\.(.+)|)/;function ke(){return!0}function Se(){return!1}function Ne(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==("focus"===t)}function Ae(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)Ae(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Se;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return k().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=k.guid++)),e.each(function(){k.event.add(this,t,i,r,n)})}function De(e,i,o){o?(Q.set(e,i,!1),k.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Q.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(k.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Q.set(this,i,r),t=o(this,i),this[i](),r!==(n=Q.get(this,i))||t?Q.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n.value}else r.length&&(Q.set(this,i,{value:k.event.trigger(k.extend(r[0],k.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Q.get(e,i)&&k.event.add(e,i,ke)}k.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.get(t);if(v){n.handler&&(n=(o=n).handler,i=o.selector),i&&k.find.matchesSelector(ie,i),n.guid||(n.guid=k.guid++),(u=v.events)||(u=v.events={}),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof k&&k.event.triggered!==e.type?k.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(R)||[""]).length;while(l--)d=g=(s=Ee.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=k.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=k.event.special[d]||{},c=k.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&k.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),k.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.hasData(e)&&Q.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(R)||[""]).length;while(l--)if(d=g=(s=Ee.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=k.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||k.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)k.event.remove(e,d+t[l],n,r,!0);k.isEmptyObject(u)&&Q.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=k.event.fix(e),u=new Array(arguments.length),l=(Q.get(this,"events")||{})[s.type]||[],c=k.event.special[s.type]||{};for(u[0]=s,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,qe=/\s*$/g;function Oe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&k(e).children("tbody")[0]||e}function Pe(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Re(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Me(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(Q.hasData(e)&&(o=Q.access(e),a=Q.set(t,o),l=o.events))for(i in delete a.handle,a.events={},l)for(n=0,r=l[i].length;n")},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=oe(e);if(!(y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||k.isXMLDoc(e)))for(a=ve(c),r=0,i=(o=ve(e)).length;r").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Vt,Gt=[],Yt=/(=)\?(?=&|$)|\?\?/;k.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Gt.pop()||k.expando+"_"+kt++;return this[e]=!0,e}}),k.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Yt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Yt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Yt,"$1"+r):!1!==e.jsonp&&(e.url+=(St.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||k.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?k(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Gt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Vt=E.implementation.createHTMLDocument("").body).innerHTML="

    ",2===Vt.childNodes.length),k.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=D.exec(e))?[t.createElement(i[1])]:(i=we([e],t,o),o&&o.length&&k(o).remove(),k.merge([],i.childNodes)));var r,i,o},k.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(k.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},k.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){k.fn[t]=function(e){return this.on(t,e)}}),k.expr.pseudos.animated=function(t){return k.grep(k.timers,function(e){return t===e.elem}).length},k.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=k.css(e,"position"),c=k(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=k.css(e,"top"),u=k.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,k.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},k.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){k.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===k.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===k.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=k(e).offset()).top+=k.css(e,"borderTopWidth",!0),i.left+=k.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-k.css(r,"marginTop",!0),left:t.left-i.left-k.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===k.css(e,"position"))e=e.offsetParent;return e||ie})}}),k.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;k.fn[t]=function(e){return _(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),k.each(["top","left"],function(e,n){k.cssHooks[n]=ze(y.pixelPosition,function(e,t){if(t)return t=_e(e,n),$e.test(t)?k(e).position()[n]+"px":t})}),k.each({Height:"height",Width:"width"},function(a,s){k.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){k.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return _(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?k.css(e,t,i):k.style(e,t,n,i)},s,n?e:void 0,n)}})}),k.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){k.fn[n]=function(e,t){return 0',n=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent"],s=e(i).data("autosize",!0)[0];s.style.lineHeight="99px","99px"===e(s).css("lineHeight")&&n.push("lineHeight"),s.style.lineHeight="",e.fn.autosize=function(i){return this.length?(i=e.extend({},o,i||{}),s.parentNode!==document.body&&e(document.body).append(s),this.each(function(){function o(){var t,o;"getComputedStyle"in window?(t=window.getComputedStyle(u,null),o=u.getBoundingClientRect().width,e.each(["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"],function(e,i){o-=parseInt(t[i],10)}),s.style.width=o+"px"):s.style.width=Math.max(p.width(),0)+"px"}function a(){var a={};if(t=u,s.className=i.className,d=parseInt(p.css("maxHeight"),10),e.each(n,function(e,t){a[t]=p.css(t)}),e(s).css(a),o(),window.chrome){var r=u.style.width;u.style.width="0px",u.offsetWidth,u.style.width=r}}function r(){var e,n;t!==u?a():o(),s.value=u.value+i.append,s.style.overflowY=u.style.overflowY,n=parseInt(u.style.height,10),s.scrollTop=0,s.scrollTop=9e4,e=s.scrollTop,d&&e>d?(u.style.overflowY="scroll",e=d):(u.style.overflowY="hidden",c>e&&(e=c)),e+=w,n!==e&&(u.style.height=e+"px",f&&i.callback.call(u,u))}function l(){clearTimeout(h),h=setTimeout(function(){var e=p.width();e!==g&&(g=e,r())},parseInt(i.resizeDelay,10))}var d,c,h,u=this,p=e(u),w=0,f=e.isFunction(i.callback),z={height:u.style.height,overflow:u.style.overflow,overflowY:u.style.overflowY,wordWrap:u.style.wordWrap,resize:u.style.resize},g=p.width();p.data("autosize")||(p.data("autosize",!0),("border-box"===p.css("box-sizing")||"border-box"===p.css("-moz-box-sizing")||"border-box"===p.css("-webkit-box-sizing"))&&(w=p.outerHeight()-p.height()),c=Math.max(parseInt(p.css("minHeight"),10)-w||0,p.height()),p.css({overflow:"hidden",overflowY:"hidden",wordWrap:"break-word",resize:"none"===p.css("resize")||"vertical"===p.css("resize")?"none":"horizontal"}),"onpropertychange"in u?"oninput"in u?p.on("input.autosize keyup.autosize",r):p.on("propertychange.autosize",function(){"value"===event.propertyName&&r()}):p.on("input.autosize",r),i.resizeDelay!==!1&&e(window).on("resize.autosize",l),p.on("autosize.resize",r),p.on("autosize.resizeIncludeStyle",function(){t=null,r()}),p.on("autosize.destroy",function(){t=null,clearTimeout(h),e(window).off("resize",l),p.off("autosize").off(".autosize").css(z).removeData("autosize")}),r())})):this}})(window.jQuery||window.$); \ No newline at end of file diff --git a/upload/engine/modules/ymaps/js/jquery.easyResponsiveTabs.min.js b/engine/modules/ymaps/js/jquery.easyResponsiveTabs.min.js similarity index 100% rename from upload/engine/modules/ymaps/js/jquery.easyResponsiveTabs.min.js rename to engine/modules/ymaps/js/jquery.easyResponsiveTabs.min.js diff --git a/upload/engine/modules/ymaps/js/jquery.form.min.js b/engine/modules/ymaps/js/jquery.form.min.js similarity index 100% rename from upload/engine/modules/ymaps/js/jquery.form.min.js rename to engine/modules/ymaps/js/jquery.form.min.js diff --git a/upload/engine/modules/ymaps/js/jquery.formstyler.min.js b/engine/modules/ymaps/js/jquery.formstyler.min.js similarity index 100% rename from upload/engine/modules/ymaps/js/jquery.formstyler.min.js rename to engine/modules/ymaps/js/jquery.formstyler.min.js diff --git a/upload/engine/modules/ymaps/js/jquery.ladda.min.js b/engine/modules/ymaps/js/jquery.ladda.min.js similarity index 100% rename from upload/engine/modules/ymaps/js/jquery.ladda.min.js rename to engine/modules/ymaps/js/jquery.ladda.min.js diff --git a/upload/engine/modules/ymaps/js/jquery.magnificpopup.min.js b/engine/modules/ymaps/js/jquery.magnificpopup.min.js similarity index 100% rename from upload/engine/modules/ymaps/js/jquery.magnificpopup.min.js rename to engine/modules/ymaps/js/jquery.magnificpopup.min.js diff --git a/engine/modules/ymaps/js/main.js b/engine/modules/ymaps/js/main.js new file mode 100644 index 0000000..4f86f45 --- /dev/null +++ b/engine/modules/ymaps/js/main.js @@ -0,0 +1,447 @@ +/**! + * DLE-YandexMaps — Бесплатный модуль Яндекс Карт для DLE + * + * @author ПафНутиЙ + * @link https://git.io/v9irg + */ + +var doc = $(document); +var laddaProcessObj; + +doc + .on('click', '.popup-modal-dismiss', function (e) { + e.preventDefault(); + $.magnificPopup.close(); + }) + .on('click', '.modal-close', function () { + $.magnificPopup.close(); + }) + .on('click', '.map-save', function (event) { + $('#' + $(this).data('id')).trigger('submit'); + }) + .on('click', '.mfp-open-ajax-xf', function () { + var $this = $(this), + itemData = $this.data(), + $inp = $('#' + itemData.id); + if ($this.hasClass('disabled')) { + return false; + } else { + $.magnificPopup.open({ + type: 'ajax', + gallery: { + enabled: false + }, + items: { + src: itemData.mfpSrc + }, + ajax: { + settings: { + data: { + name: $inp.val(), + description: itemData.description, + value: '', + fieldType: itemData.fieldType + } + } + }, + callbacks: { + afterClose: function () { + $('.map-save').trigger('click'); + $this.addClass('disabled'); + } + } + }); + } + }) + .on('change input keyup', '.xf-input', function () { + var $this = $(this), + valLen = $this.val().length; + if (valLen > 2) { + $this.next('span').removeClass('disabled'); + } + if (valLen < 1) { + $this.next('span').addClass('disabled'); + } + }) + .on('click', '.code', function () { + $(this).select(); + }) + // Аякс отправка формы с эффектами + .on('submit', '[data-ajax-submit]', function () { + var $this = $(this); + + var options = { + dataType: 'json', + beforeSubmit: processStartNew, + success: processDoneNew + }; + + $this.ajaxSubmit(options); + + return false; + }) + .on('submit', '[data-ladda-submit]', function (e) { + e.preventDefault(); + + var $this = $(this); + var progress = 0; + var laddaLoadNew = $this.find('.ladda-button').ladda(); + laddaLoadNew.ladda('start'); + + var interval = setInterval(function () { + progress = Math.min(progress + Math.random() * 0.2, 1); + laddaLoadNew.ladda('setProgress', progress); + + if (progress === 1) { + laddaLoadNew.ladda('stop'); + clearInterval(interval); + $this.removeAttr('data-ladda-submit').submit(); + } + }, 100); + }) + .on('click', '[data-point-change]', function () { + var itemData = $(this).data(); + + $.magnificPopup.open({ + type: 'ajax', + gallery: { + enabled: false + }, + items: { + src: 'engine/ajax/controller.php' + }, + ajax: { + settings: { + data: { + id: itemData.pointChange, + mod: 'ymaps_editmarker' + } + } + }, + callbacks: { + afterClose: function () { + // $('.map-save').trigger('click'); + // $this.addClass('disabled'); + }, + ajaxContentAdded: function () { + var $styler = $(this.content).find('.styler'); + if ($styler.length) { + $markerSelect = $('select.marker-select'); + $customMarkerSelect = $('.marker-custom-icon-select-wrapper'); + $styler.styler({ + onFormStyled: function () { + showSelectedPoint($styler); + if ($markerSelect.val() === 'custom') { + $customMarkerSelect.show(); + showSelectedPoint($customMarkerSelect.find('select.styler')); + } + + } + }); + } + + } + } + }); + }) + .on('click', '[data-point-delete]', function () { + var $this = $(this); + var itemData = $this.data(); + var progress = 0; + var laddaLoadNew = $this.ladda(); + laddaLoadNew.ladda('start'); + + $.ajax({ + url: 'engine/ajax/ymaps/saveconfig.php', + type: 'POST', + data: { + pointID: itemData.pointDelete, + deletePoint: 'y' + } + }) + .done(function () { + console.log('done'); + }) + .fail(function () { + console.log('error'); + }).always(function () { + var interval = setInterval(function () { + progress = Math.min(progress + Math.random() * 0.2, 1); + laddaLoadNew.ladda('setProgress', progress); + + if (progress === 1) { + laddaLoadNew.ladda('stop'); + clearInterval(interval); + location.reload(); + } + }, 100); + }); + + /* Act on the event */ + }) + .on('change', 'select.marker-select', function () { + var $this = $(this), + $customMarkerSelect = $('.marker-custom-icon-select-wrapper'); + showSelectedPoint($this); + if ($this.val() === 'custom') { + $customMarkerSelect.show().find('.styler').trigger('refresh'); + showSelectedPoint($customMarkerSelect.find('select.styler')); + } else { + if (!$this.hasClass('marker-custom-icon-select')) { + $customMarkerSelect.hide(); + } + } + }) + .on('change', 'select.marker-custom-icon-select', function () { + // var $option = $(this).find('option:selected'), + // $oData = $option.data(); + // console.log($oData); + }) + .on('input keyup', '.set-icon-color-input', function () { + var $this = $(this), + thisVal = $this.val(); + $('.selected-marker').css('background', thisVal); + + }); + +// pre-submit callback +function processStartNew(formData, jqForm) { + laddaProcessObj = jqForm.find('.ladda-button').ladda(); + laddaProcessObj.ladda('start'); + + return true; +} + +// post-submit callback +function processDoneNew(responseText, statusText, xhr, $form) { + + var formContent = $form.html(); + var responseResult = (formContent) ? formContent : responseText; + + var progress = 0; + var interval = setInterval(function () { + progress = Math.min(progress + Math.random() * 0.2, 1); + laddaProcessObj.ladda('setProgress', progress); + + if (progress === 1) { + laddaProcessObj.ladda('stop'); + laddaProcessObj = null; + clearInterval(interval); + // Тут что-то делаем с пришедшими данными + if (statusText === 'success') { + if ($form.data('ajaxSubmit') === 'reload') { + location.reload(); + } + + if ($form.data('ajaxSubmit') !== 'noreload' && $form.data('ajaxSubmit') !== 'reload') { + $form.html(responseResult); + } + + } + + } + + }, 100); +} + +// Как только будет загружен API и готов DOM, выполняем инициализацию +ymaps.ready(init); + +// Инициализация карты. +function init() { + var demoMap, + myPlacemark, + $lat = $('#mapCenterLat'), + $lon = $('#mapCenterLon'), + $zoom = $('#mapCenterZoom'), + lat = ($lat.val()) ? $lat.val() : '51.5350', + lon = ($lon.val()) ? $lon.val() : '46.0259', + zoom = ($zoom.val()) ? $zoom.val() : '9'; + doc + .on('mapInit', function () { + var mapHeightVal = $('#mapHeight').val(); + var controls = []; + var height = (mapHeightVal) ? mapHeightVal : 400; + var $map = $('#map'); + + $map.height(height); + + $.each($('input[name*="controls"]'), function (index, val) { + var $this = $(this); + var id = $this.prop('id'); + if ($this.prop('checked')) { + controls.push(id); + } + + }); + if (!demoMap) { + + demoMap = new ymaps.Map('map', { + center: [lat, lon], // Саратов + zoom: zoom, + controls: controls + }); + } + + // Слушаем клик на карте + demoMap.events.add('click', function (e) { + var coords = e.get('coords'); + + // Если метка уже создана – просто передвигаем ее + if (myPlacemark) { + myPlacemark.geometry.setCoordinates(coords); + } + // Если нет – создаем. + else { + myPlacemark = createPlacemark(coords); + demoMap.geoObjects.add(myPlacemark); + // Слушаем событие окончания перетаскивания на метке. + myPlacemark.events.add('dragend', function () { + setCenter(myPlacemark.geometry.getCoordinates(), demoMap.getZoom()); + }); + } + setCenter(coords, demoMap.getZoom()); + }); + + // Создание метки + function createPlacemark(coords) { + return new ymaps.Placemark(coords, + { + preset: 'islands#icon', + draggable: true, + iconColor: '#0095b6' + }); + } + + function setCenter(coords, zoom) { + $lat.val(coords[0].toPrecision(6)); + $lon.val(coords[1].toPrecision(6)); + $zoom.val(zoom); + } + }) + .on('mapDestroy', function () { + /**/ + }); +} + +jQuery(document).ready(function ($) { + + // Авторазмер для блоков с кодом + $('.code').autosize(); + + // Селекты + $('.styler').styler(); + + // Прячем кнопки создания допполей + $.each($('.xf-input'), function () { + if ($(this).val().length) { + $(this).next('span').addClass('disabled'); + } + + }); + + // Инициализация Ladda + var laddaLoad = $('.ladda-button-old').ladda(); + + // Дефолтные настройки аякс формы + var formOptions = { + dataType: 'json', + beforeSubmit: processStart, + success: processDone + }; + + // Табы настроек + $('#settings').easyResponsiveTabs(); + + // Дефолтные настройки magnificpopup + $.extend(true, $.magnificPopup.defaults, { + tClose: 'Закрыть (Esc)', // Alt text on close button + tLoading: 'Загрузка...', // Text that is displayed during loading. Can contain %curr% and %total% keys + ajax: { + tError: 'Контент не загружен.' // Error message when ajax request failed + } + }); + + // + $('#settingsForm').ajaxForm(formOptions); + + $('.mfp-open').magnificPopup(); + + $('.mfp-open-ajax').magnificPopup({ + type: 'ajax' + }); + + $('.mfp-open-modal-map').magnificPopup({ + type: 'inline', + preloader: false, + // focus: '#username', + modal: true, + callbacks: { + open: function () { + doc.trigger('mapInit'); + }, + afterClose: function () { + doc.trigger('mapDestroy'); + } + } + }); + + /** + * [processStart description] + * @return {[type]} [description] + */ + function processStart() { + laddaLoad.ladda('start') + } + + /** + * [processDone description] + * @param {[type]} data [description] + * @return {[type]} [description] + */ + function processDone(data) { + var progress = 0; + var interval = setInterval(function () { + progress = Math.min(progress + Math.random() * 0.2, 1); + laddaLoad.ladda('setProgress', progress); + + if (progress === 1) { + laddaLoad.ladda('stop'); + clearInterval(interval); + } + }, 100); + } +}); + +function showSelectedPoint(obj) { + var selectedData = obj.find('option:selected').data(); + var $marker = $('.selected-marker'); + var $iconLayout = $('.iconLayout'); + var $iconImageSize0 = $('.iconImageSize0'); + var $iconImageSize1 = $('.iconImageSize1'); + var $iconImageOffset0 = $('.iconImageOffset0'); + var $iconImageOffset1 = $('.iconImageOffset1'); + + $marker.prop('src', selectedData.selectImg); + $('.set-icon-color-input').remove(); + $marker.css('background', 'none'); + + if (selectedData.iconColor) { + $marker.css('background', selectedData.iconColor); + $('.marker-select-wrapper').append(''); + } + + if (selectedData.sizeWidth > 0) { + $iconLayout.val('default#image'); + $iconImageSize0.val(selectedData.sizeWidth); + $iconImageSize1.val(selectedData.sizeHeight); + $iconImageOffset0.val((selectedData.offsetWidth !== '') ? selectedData.offsetWidth : '-' + Math.round(selectedData.sizeWidth / 2)); + $iconImageOffset1.val((selectedData.offsetHeight !== '') ? selectedData.offsetHeight : '-' + Math.round(selectedData.sizeHeight / 2)); + } else { + $iconLayout.val(''); + $iconImageSize0.val(''); + $iconImageSize1.val(''); + $iconImageOffset0.val(''); + $iconImageOffset1.val(''); + } +} diff --git a/engine/modules/ymaps/js/ymaps_editnews.js b/engine/modules/ymaps/js/ymaps_editnews.js new file mode 100644 index 0000000..ce3c9f9 --- /dev/null +++ b/engine/modules/ymaps/js/ymaps_editnews.js @@ -0,0 +1,320 @@ +/* eslint-disable no-undef */ +/* eslint-env es5 */ + +/** ! + * DLE-YandexMaps — Бесплатный модуль Яндекс Карт для DLE + * + * @author ПафНутиЙ + * @link https://git.io/v9irg + */ + +/** + * @typedef {object} mapConfig + * + * @property {string} mapSelector + * @property {array} scripts + * @property {array} controls + * @property {number} height + * @property {object} defaultPos + * @property {string} defaultPos.lat + * @property {string} defaultPos.lon + * @property {string} defaultPos.zoom + * @property {object} arPlacemarkStyles + * @property {string} inputSelector + * @property {string} xfHolder + * @property {string} modalHtml + * @property {string} btnHtml + * @property {object} text + * @property {string} text.edit + * @property {string} text.add + */ +var doc = $(document); + +doc + .on('dialogopen', '#dlepopup-news-edit', function() { + setTimeout( + loadController + , 500); + }) + .on('click', '.popup-modal-dismiss', function(e) { + e.preventDefault(); + $.magnificPopup.close(); + }); + +var loadController = function () { + // eslint-disable-next-line camelcase + var dleRoot = window.dle_root || '/'; + $.ajax({ + url: dleRoot + 'engine/ajax/controller.php', + data: { + mod: 'ymaps_editnews' + } + }) + .done(function(data) { + runQuickEdit(data); + }) + .fail(function() { + console.error('error'); + }); +}; + +var loadScript = function(url, callback) { + var script = document.createElement('script'); + script.src = url; + if (callback) { + script.onload = callback; + } + document.getElementsByTagName('head')[0].appendChild(script); +}; + +var runQuickEdit = function(mapConfig) { + if ($(mapConfig.inputSelector).length) { + mapConfig.scripts.forEach(function(scriptUrl) { + loadScript(scriptUrl); + }); + + if (window.ymaps) { + ymapsStart(mapConfig); + } else { + loadScript(mapConfig.mapUrl, function () { + ymapsStart(mapConfig); + }); + } + } +}; + +/** + * + * @param {mapConfig} mapConfig + */ +var ymapsStart = function(mapConfig) { + var $xfieldInput = $(mapConfig.inputSelector); + + var $btnHtml = $(mapConfig.btnHtml); + + $xfieldInput + .parent() + .append($btnHtml) + .append($(mapConfig.modalHtml)); + + // $btnHtml.insertAfter($xfieldInput); + + var $editMapBtn = $('.btn-editmap-modal'); + + var editnewsMap = window.editnewsMap; + var myPlacemark; + + var methods = { + checkBtnText: function() { + var $this = $(mapConfig.inputSelector); + if ($this.val().length) { + $editMapBtn.text(mapConfig.text.edit); + } else { + $editMapBtn.text(mapConfig.text.add); + } + }, + toggleXFieldAndBtn: function() { + var $xfHolder = $(mapConfig.xfHolder); + if ($xfHolder.length) { + if ($xfHolder.css('display') !== 'none') { + $xfieldInput.hide(); + } + } else { + if ($xfieldInput.css('display') !== 'none') { + $xfieldInput.hide(); + $btnHtml.show(); + } else { + $btnHtml.hide(); + } + } + }, + + /** + * @returns {{lat: string, lon: string, zoom: string}|any | jQuery | null | undefined} + */ + getCoordsFromInput: function() { + var pointInput = $xfieldInput; + if (pointInput.val()) { + return $.parseJSON(pointInput.val()); + } else { + return mapConfig.defaultPos; + } + }, + + /** + * + * @param coords + * @param zoom + */ + setCenter: function(coords, zoom) { + if (coords && coords.length && zoom) { + var inpText = + '{"lat":"' + + coords[0].toPrecision(6) + + '", "lon" : "' + + coords[1].toPrecision(6) + + '", "zoom": "' + + zoom + + '"}'; + $xfieldInput.val(inpText); + } + methods.checkBtnText(); + }, + + /** + * + * @returns {Array} + */ + getDataFromInput: function() { + var returnValue = []; + var inputValue = $xfieldInput.val(); + if (inputValue) { + var inputCoords = JSON.parse(inputValue); + returnValue = [inputCoords.lat * 1, inputCoords.lon * 1]; + } + return returnValue; + }, + + resetCoords: function() { + $xfieldInput.val(''); + methods.checkBtnText(); + }, + + /** + * + * @param coords + * @returns {object} ymaps.Placemark + */ + createPlacemark: function(coords) { + var $catList = $('[name="catlist[]"]'); + var categoryId = 0; + if ($catList.length) { + categoryId = $catList.find('option:selected').val() || $catList.val(); + } + var key = categoryId > 0 ? categoryId : 'default'; + var placemarkStyle = mapConfig.arPlacemarkStyles; + + return new ymaps.Placemark(coords, {}, placemarkStyle[key]); + }, + + /** + * + * @param res + */ + addOrMovePlacemark: function(res) { + // Пробуем получить метку из геометрии переданной точки (если точка передана из поиска) + var coords = res.geometry && res.geometry.getCoordinates(); + + // Или пробуем достать её из текущих координат (если это клик по карте) + if (!coords) { + coords = res.get('coords'); + } + // Если метка уже создана – просто передвигаем ее + if (myPlacemark) { + myPlacemark.geometry.setCoordinates(coords); + } else { + // Если нет – создаем. + myPlacemark = methods.createPlacemark(coords); + editnewsMap.geoObjects.add(myPlacemark); + + // Слушаем событие окончания перетаскивания на метке. + myPlacemark.events.add('dragend', function() { + methods.setCenter(myPlacemark.geometry.getCoordinates(), editnewsMap.getZoom()); + }); + } + methods.setCenter(myPlacemark.geometry.getCoordinates(), editnewsMap.getZoom()); + } + }; + + doc + .off('.ymapsEdit') + .on('change.ymapsEdit', '#category, [name="category[]"]', methods.toggleXFieldAndBtn) + .on('change.ymapsEdit', mapConfig.inputSelector, methods.checkBtnText) + .on('click.ymapsEdit', '.btn-clear-placemark', methods.resetCoords); + + // Инициализация карты. + ymaps.ready(addMapInit); + + function addMapInit() { + // Скрываем поле с координатами карты, оно не нужно пользователю. + methods.toggleXFieldAndBtn(); + methods.checkBtnText(); + + // Убираем блокировку с кнопки открытия модального окна + $editMapBtn.prop('disabled', false); + + doc + .on('mapInit.ymapsEdit', function() { + var $map = $('#' + mapConfig.mapSelector); + var coors = methods.getCoordsFromInput(); + var lat = coors.lat; + var lon = coors.lon; + var zoom = coors.zoom; + + // На всякий случай устанавливаем высоту карты + $map.height(mapConfig.height); + + if (editnewsMap) { + myPlacemark = false; + editnewsMap.events.remove(['click', 'boundschange', 'dragend', 'resultselect', 'submit']); + editnewsMap.destroy(); + } + + editnewsMap = new ymaps.Map(mapConfig.mapSelector, { + center: [lat, lon], // Саратов + zoom: zoom, + controls: mapConfig.controls + }); + + var searchControl = editnewsMap.controls.get('searchControl'); + + if (searchControl) { + searchControl.options.set('noPlacemark', true); + searchControl.events.add('resultselect', function(e) { + var index = e.get('index'); + searchControl.getResult(index).then(methods.addOrMovePlacemark); + }); + } + + var dataFromInput = methods.getDataFromInput(); + + if (dataFromInput) { + myPlacemark = methods.createPlacemark(dataFromInput); + editnewsMap.geoObjects.add(myPlacemark); + } + + // Слушаем клик на карте + editnewsMap.events.add('click', methods.addOrMovePlacemark).add('boundschange', function() { + var coords = [lat * 1, lon * 1]; + + if (myPlacemark) { + coords = myPlacemark.geometry.getCoordinates(); + } + methods.setCenter(coords, editnewsMap.getZoom()); + }); + }) + .on('click.ymapsEdit', '.btn-editmap-modal', function() { + if ($.magnificPopup) { + // Дефолтные настройки magnificpopup + $.extend(true, $.magnificPopup.defaults, { + tClose: 'Закрыть (Esc)', + tLoading: 'Загрузка...' + }); + + $.magnificPopup.open({ + type: 'inline', + items: { + src: '#' + mapConfig.mapSelector + '-modal' + }, + preloader: false, + modal: true, + callbacks: { + open: function() { + doc.trigger('mapInit'); + } + } + }); + } + }); + } +}; diff --git a/upload/engine/modules/ymaps/language/.htaccess b/engine/modules/ymaps/language/.htaccess similarity index 100% rename from upload/engine/modules/ymaps/language/.htaccess rename to engine/modules/ymaps/language/.htaccess diff --git a/engine/modules/ymaps/language/Russian.lng b/engine/modules/ymaps/language/Russian.lng new file mode 100644 index 0000000..207d42c --- /dev/null +++ b/engine/modules/ymaps/language/Russian.lng @@ -0,0 +1,93 @@ + 'Russian', + 'moduleLangName' => 'Язык', + 'moduleSettings' => 'Настройки', + 'allmapsSettings' => 'Настройки страницы с метками', + 'mapsHelp' => 'Справка (Rus)', + 'mapsSupport' => 'Справка и техподдержка', + 'moduleOn' => 'Включить модуль', + 'moduleTextManagment' => 'Управление модулем', + 'moduleTextAllSections' => 'Список всех разделов', + 'moduleTextCheckUpdates' => 'Проверить обновления', + + 'mapSettings' => 'Настройки карты', + 'mapsSettings' => 'Настройки страницы с метками', + + 'moduleTextApiKey' => 'API Key Яндекс карт', + 'moduleTextApiKeyWhat' => 'Условия использования карт', + 'moduleTextMapHeight' => 'Высота карты по умолчанию (px)', + 'moduleTextMapControls' => 'Элементы управления картой', + 'moduleTextMapFullScreen' => 'кнопка разворачивания карты на весь экран', + 'moduleTextMapLocation' => 'кнопка определения местоположения пользователя', + 'moduleTextMapRoute' => 'кнопка включения и отключения поведения "редактор маршрута"', + 'moduleTextMapRuler' => 'кнопка включения и отключения поведения "линейка"', + 'moduleTextMapSearchPanel' => 'панель поиска', + 'moduleTextMapProbki' => 'панель пробок', + 'moduleTextMapTypeTrigger' => 'панель переключения типа карты', + 'moduleTextMapZoom' => 'ползунок масштаба', + 'moduleTextMapZoomDefault' => 'Центр карты и зум по умолчанию', + 'moduleTextMapLat' => 'Широта', + 'moduleTextMapLon' => 'Долгота', + 'moduleTextMapZoomPlaceholder' => 'Зум', + 'moduleTextMapSelectOnMap' => 'выбрать на карте', + 'moduleTextMapZoomXf' => 'Имя допполя для информации о точке', + 'moduleTextMapZoomXfPlaceholder' => 'Координаты и зум карты', + 'moduleTextMapZoomXfPlaceholderText' => 'Например coords', + 'moduleTextMapBaloonXf' => 'Имя допполя для содержимого балуна', + 'moduleTextMapBaloonXfPlaceholder' => 'Содержимое балуна карты', + 'moduleTextMapBaloonXfPlaceholderText' => 'Например balloon', + 'moduleTextEnterPlacemarkText' => 'Введите описание метки', + 'moduleTextMissedTemplateFile' => 'Отсутствует файл шаблона', + 'moduleActionYes' => 'Да', + 'moduleActionNo' => 'Нет', + 'moduleActionClose' => 'Закрыть', + 'moduleActionSave' => 'Сoхранить', + 'moduleActionCancel' => 'Отменить', + 'moduleActionCreateXf' => 'Создать поле', + 'ot' => 'от', + 'field' => 'Поле', + 'successfullyСreated' => 'успешно создано!', + 'xfieldsSetup' => 'управление допполями', + 'contactsForSupport' => 'Контакты для связи и техподдержки:', + + // 1.4 + 'mapsPointSettings' => 'Настройка меток', + 'pointersCat' => 'Метки в категориях: ', + 'pointersCatDefault' => 'Иконка по умолчанию: ', + 'catIdWrong' => 'Категория не существует', + 'moduleActionApply' => 'Применить', + 'moduleActionReset' => 'Сбросить', + 'markerCustomColor' => ' (свой цвет)', + 'moduleActionChange' => 'Изменить', + 'moduleActionAdd' => 'Добавить', + 'moduleTextMarkerSettingsHeader' => 'Настройка метки для категории: ', + 'moduleTextMarkerWText' => 'Метки с текстом', + 'moduleTextMarkerStrech' => 'Резиновые метки с текстом', + 'moduleTextMarkerWDot' => 'Метки с точкой', + 'moduleTextMarkerRound' => 'Круглые метки', + 'moduleTextMarkerRoundWDot' => 'Круглые метки с точкой', + 'moduleTextMarkerCustom' => 'Собственное изображение', + 'moduleTextIconWidth' => 'Ширина иконки: ', + 'moduleTextIconHeight' => 'Высота иконки: ', + 'moduleTextIconOffWidth' => 'Смещение по гоизонтали: ', + 'moduleTextIconOffHeight' => 'Смещение по вертикали: ', + 'moduleTextExampleLink' => 'Пример позиционирования иконки', + 'moduleTextEditPlacemark' => 'Редактировать метку', + 'moduleTextAddPlacemark' => 'Добавить метку', + 'moduleTextDelPlacemark' => 'Удалить метку', + 'moduleTextHelp' => 'Справка по модулю', + 'moduleLongText1' => 'Справка по модулю находится на официальном сайте поддержки по адресу', + 'moduleTextSupportСond' => 'Техническая поддержка', + + // 1.4.3 + 'moduleActionDelete' => 'Удалить', + + // 1.4.4 + 'moduleTextDocks' => 'Документация и примеры использования', + + // 3.0.0 + 'moduleTextForWhatApiKey' => 'API-Key нужен для возможности использования поиска по карте и других операций, связанных с геокодингом', + 'moduleTitle' => 'Yandex Maps', +]; \ No newline at end of file diff --git a/upload/engine/skins/images/ymaps.png b/engine/skins/images/ymaps.png similarity index 100% rename from upload/engine/skins/images/ymaps.png rename to engine/skins/images/ymaps.png diff --git a/upload/templates/Default/ymaps/.htaccess b/templates/{THEME}/ymaps/.htaccess similarity index 100% rename from upload/templates/Default/ymaps/.htaccess rename to templates/{THEME}/ymaps/.htaccess diff --git a/upload/engine/plugins/.htaccess b/templates/{THEME}/ymaps/all/.htaccess similarity index 54% rename from upload/engine/plugins/.htaccess rename to templates/{THEME}/ymaps/all/.htaccess index cb24fd7..7d3aaf1 100644 --- a/upload/engine/plugins/.htaccess +++ b/templates/{THEME}/ymaps/all/.htaccess @@ -1,2 +1,2 @@ Order allow,deny -Deny from all +Deny from all \ No newline at end of file diff --git a/templates/{THEME}/ymaps/all/allplacemarks.tpl b/templates/{THEME}/ymaps/all/allplacemarks.tpl new file mode 100644 index 0000000..af4bad3 --- /dev/null +++ b/templates/{THEME}/ymaps/all/allplacemarks.tpl @@ -0,0 +1,2 @@ +startFrom = 0 +limit = 1500 \ No newline at end of file diff --git a/upload/templates/Default/ymaps/all/default.tpl b/templates/{THEME}/ymaps/all/default.tpl similarity index 100% rename from upload/templates/Default/ymaps/all/default.tpl rename to templates/{THEME}/ymaps/all/default.tpl diff --git a/templates/{THEME}/ymaps/all_placemarks.tpl b/templates/{THEME}/ymaps/all_placemarks.tpl new file mode 100644 index 0000000..9f95996 --- /dev/null +++ b/templates/{THEME}/ymaps/all_placemarks.tpl @@ -0,0 +1,129 @@ +{* + Этот файл следует подключать в другие шаблоны вот так: + + include file="ymaps/all_placemarks.tpl" + +*} + + +{* При необходимости переместить стили в CSS файл *} + + +{* Если скрипт я.карт уже есть на странице, это подключение не нужно *} + + + +{* В этом блоке будет отображаться карта *} +
    \ No newline at end of file diff --git a/templates/{THEME}/ymaps/default.tpl b/templates/{THEME}/ymaps/default.tpl new file mode 100644 index 0000000..fdd8a79 --- /dev/null +++ b/templates/{THEME}/ymaps/default.tpl @@ -0,0 +1,53 @@ +{scripts} + +Показать карту + +
    + +
    \ No newline at end of file diff --git a/upload/templates/Default/ymaps/all/.htaccess b/templates/{THEME}/ymaps/icons/.htaccess similarity index 100% rename from upload/templates/Default/ymaps/all/.htaccess rename to templates/{THEME}/ymaps/icons/.htaccess diff --git a/upload/templates/Default/ymaps/icons/blue1.png b/templates/{THEME}/ymaps/icons/blue1.png similarity index 100% rename from upload/templates/Default/ymaps/icons/blue1.png rename to templates/{THEME}/ymaps/icons/blue1.png diff --git a/upload/templates/Default/ymaps/icons/blue2.png b/templates/{THEME}/ymaps/icons/blue2.png similarity index 100% rename from upload/templates/Default/ymaps/icons/blue2.png rename to templates/{THEME}/ymaps/icons/blue2.png diff --git a/upload/templates/Default/ymaps/icons/blue3.png b/templates/{THEME}/ymaps/icons/blue3.png similarity index 100% rename from upload/templates/Default/ymaps/icons/blue3.png rename to templates/{THEME}/ymaps/icons/blue3.png diff --git a/upload/templates/Default/ymaps/icons/human.png b/templates/{THEME}/ymaps/icons/human.png similarity index 100% rename from upload/templates/Default/ymaps/icons/human.png rename to templates/{THEME}/ymaps/icons/human.png diff --git a/upload/templates/Default/ymaps/simple.tpl b/templates/{THEME}/ymaps/simple.tpl similarity index 50% rename from upload/templates/Default/ymaps/simple.tpl rename to templates/{THEME}/ymaps/simple.tpl index 6b551db..a802ab1 100644 --- a/upload/templates/Default/ymaps/simple.tpl +++ b/templates/{THEME}/ymaps/simple.tpl @@ -1,34 +1,34 @@ {script_yandex} diff --git a/upload/templates/Default/ymaps/ymaps.css b/templates/{THEME}/ymaps/ymaps.css similarity index 72% rename from upload/templates/Default/ymaps/ymaps.css rename to templates/{THEME}/ymaps/ymaps.css index 2df29f9..99fe7a6 100644 --- a/upload/templates/Default/ymaps/ymaps.css +++ b/templates/{THEME}/ymaps/ymaps.css @@ -5,61 +5,6 @@ * @link https://git.io/v9irg */ -/* ========================================================================== - Buttons */ -/* ========================================================================== */ - - .btn { - display: inline-block; - color: #ffffff; - margin-bottom: 0; - font-weight: normal; - text-align: center; - vertical-align: middle; - cursor: pointer; - background-image: none; - background: #4a9fc5; - border: 0; - text-decoration: none; - white-space: nowrap; - padding: 7px 15px 5px; - font-size: 14px; - line-height: 20px; - border-radius: 3px; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - -webkit-transition: all ease 0.3s; - -moz-transition: all ease 0.3s; - -o-transition: all ease 0.3s; - transition: all ease 0.3s; - -webkit-box-shadow: 0 2px 0 #3584a7; - -moz-box-shadow: 0 2px 0 #3584a7; - box-shadow: 0 2px 0 #3584a7; - } - .btn:focus { - outline: thin dotted #333; - outline: 5px auto -webkit-focus-ring-color; - outline-offset: -2px; - } - .btn:hover, - .btn:focus { - color: #ffffff; - background: #50bd98; - text-decoration: none; - -webkit-box-shadow: 0 2px 0 #3c9e7d; - -moz-box-shadow: 0 2px 0 #3c9e7d; - box-shadow: 0 2px 0 #3c9e7d; - } - .btn:active, - .btn.active { - outline: 0; - -webkit-box-shadow: 0 2px 0 #50bd98; - -moz-box-shadow: 0 2px 0 #50bd98; - box-shadow: 0 2px 0 #50bd98; - } - /* ========================================================================== Magnific Popup CSS */ @@ -94,4 +39,4 @@ .map-wrapper { border: solid 1px #a3aaba; margin: 10px 0; - } \ No newline at end of file + } diff --git a/templates/{THEME}/ymaps/ymaps.js b/templates/{THEME}/ymaps/ymaps.js new file mode 100644 index 0000000..640f295 --- /dev/null +++ b/templates/{THEME}/ymaps/ymaps.js @@ -0,0 +1,240 @@ +/* eslint-disable no-undef */ +/* eslint-env es5 */ +/** ! + * DLE-YandexMaps — Бесплатный модуль Яндекс Карт для DLE + * + * @author ПафНутиЙ + * @link https://git.io/v9irg + */ + +/** + * @typedef {object} mapConfig + * + * @property {string} mapSelector + * @property {boolean} isInline + * @property {string} mapUrl + * @property {array} controls + * @property {number} height + * @property {object} defaultPos + * @property {string} defaultPos.lat + * @property {string} defaultPos.lon + * @property {string} defaultPos.zoom + * @property {object} arPlacemarkStyles + * @property {string} inputSelector + * @property {string} xfHolder + */ + +/** + * Функция, запускающая скрипт карты. вызывается из php файла + * @param {mapConfig} mapConfig + */ +// eslint-disable-next-line no-unused-vars +var addNewsMapStart = function(mapConfig) { + var script = document.createElement('script'); + script.src = mapConfig.mapUrl; + script.onload = function() { + ymapsStart(mapConfig); + }; + document.getElementsByTagName('head')[0].appendChild(script); +}; + +/** + * + * @param {mapConfig} mapConfig + */ +var ymapsStart = function(mapConfig) { + var addnewsMap, myPlacemark; + var methods = { + toggleXFieldAndBtn: function() { + var $btn = $('.btn-addmap'); + if ($(mapConfig.xfHolder).css('display') !== 'none') { + $(mapConfig.xfHolder).hide(); + $btn.show(); + } else { + $btn.hide(); + } + }, + + /** + * + * @returns {{lat: string, lon: string, zoom: string}|any | jQuery | null | undefined} + */ + getCoordsFromInput: function() { + var pointInput = $(mapConfig.inputSelector); + if (pointInput.val()) { + return $.parseJSON(pointInput.val()); + } else { + return mapConfig.defaultPos; + } + }, + + /** + * + * @param coords + * @param zoom + */ + setCenter: function(coords, zoom) { + if (coords && coords.length && zoom) { + var inpText = + '{"lat":"' + + coords[0].toPrecision(6) + + '", "lon" : "' + + coords[1].toPrecision(6) + + '", "zoom": "' + + zoom + + '"}'; + $(mapConfig.inputSelector).val(inpText); + } + }, + + /** + * + * @returns {Array} + */ + getDataFromInput: function() { + var returnValue = []; + var inputValue = $(mapConfig.inputSelector).val(); + if (inputValue) { + var inputCoords = JSON.parse(inputValue); + returnValue = [inputCoords.lat * 1, inputCoords.lon * 1]; + } + return returnValue; + }, + + resetCoords: function() { + $(mapConfig.inputSelector).val(''); + }, + + /** + * + * @param coords + * @returns {object} ymaps.Placemark + */ + createPlacemark: function(coords) { + var $catList = $('[name="catlist[]"]'); + var categoryId = 0; + if ($catList.length) { + categoryId = $catList.find('option:selected').val() || $catList.val(); + } + var key = categoryId > 0 ? categoryId : 'default'; + var placemarkStyle = mapConfig.arPlacemarkStyles; + + return new ymaps.Placemark(coords, {}, placemarkStyle[key]); + }, + + /** + * + * @param res + */ + addOrMovePlacemark: function(res) { + // Пробуем получить метку из геометрии переданной точки (если точка передана из поиска) + var coords = res.geometry && res.geometry.getCoordinates(); + + // Или пробуем достать её из текущих координат (если это клик по карте) + if (!coords) { + coords = res.get('coords'); + } + // Если метка уже создана – просто передвигаем ее + if (myPlacemark) { + myPlacemark.geometry.setCoordinates(coords); + } else { + // Если нет – создаем. + myPlacemark = methods.createPlacemark(coords); + addnewsMap.geoObjects.add(myPlacemark); + + // Слушаем событие окончания перетаскивания на метке. + myPlacemark.events.add('dragend', function() { + methods.setCenter(myPlacemark.geometry.getCoordinates(), addnewsMap.getZoom()); + }); + } + methods.setCenter(myPlacemark.geometry.getCoordinates(), addnewsMap.getZoom()); + } + }; + var doc = $(document); + + doc.on('change', '#category', methods.toggleXFieldAndBtn).on('click', '.add-map-clear', methods.resetCoords); + + // Инициализация карты. + ymaps.ready(addMapInit); + + function addMapInit() { + // Скрываем поле с координатами карты, оно не нужно пользователю. + methods.toggleXFieldAndBtn(); + // Убираем блокировку с кнопки открытия модального окна + $('.btn-addmap').prop('disabled', false); + + doc.on('mapInit', function() { + var $map = $('#' + mapConfig.mapSelector); + var coors = methods.getCoordsFromInput(); + var lat = coors.lat; + var lon = coors.lon; + var zoom = coors.zoom; + + // На всякий случай устанавливаем высоту карты + $map.height(mapConfig.height); + + if (addnewsMap) { + myPlacemark = false; + addnewsMap.events.remove(['click', 'boundschange', 'dragend', 'resultselect', 'submit']); + addnewsMap.destroy(); + } + + addnewsMap = new ymaps.Map(mapConfig.mapSelector, { + center: [lat, lon], // Саратов + zoom: zoom, + controls: mapConfig.controls + }); + + var searchControl = addnewsMap.controls.get('searchControl'); + + if (searchControl) { + searchControl.options.set('noPlacemark', true); + searchControl.events.add('resultselect', function(e) { + var index = e.get('index'); + searchControl.getResult(index).then(methods.addOrMovePlacemark); + }); + } + + var dataFromInput = methods.getDataFromInput(); + + if (dataFromInput) { + myPlacemark = methods.createPlacemark(dataFromInput); + addnewsMap.geoObjects.add(myPlacemark); + } + + // Слушаем клик на карте + addnewsMap.events.add('click', methods.addOrMovePlacemark).add('boundschange', function() { + var coords = [lat * 1, lon * 1]; + + if (myPlacemark) { + coords = myPlacemark.geometry.getCoordinates(); + } + methods.setCenter(coords, addnewsMap.getZoom()); + }); + }); + + if (mapConfig.isInline) { + doc.trigger('mapInit'); + } + + if ($.magnificPopup) { + // Дефолтные настройки magnificpopup + $.extend(true, $.magnificPopup.defaults, { + tClose: 'Закрыть (Esc)', + tLoading: 'Загрузка...' + }); + + $('[data-mfp-src]').magnificPopup({ + type: 'inline', + preloader: false, + // focus: '#username', + modal: true, + callbacks: { + open: function() { + doc.trigger('mapInit'); + } + } + }); + } + } +}; diff --git a/templates/{THEME}/ymaps/ymaps_public.js b/templates/{THEME}/ymaps/ymaps_public.js new file mode 100644 index 0000000..6f81282 --- /dev/null +++ b/templates/{THEME}/ymaps/ymaps_public.js @@ -0,0 +1,34 @@ +/** ! + * DLE-YandexMaps — Бесплатный модуль Яндекс Карт для DLE + * + * @author ПафНутиЙ + * @link https://git.io/v9irg + */ + +var doc = $(document); + +doc.on('click', '.modal-close, .btn-close', function() { + $.magnificPopup.close(); +}); + +jQuery(document).ready(function($) { + // Дефолтные настройки magnificpopup + $.extend(true, $.magnificPopup.defaults, { + tClose: 'Закрыть (Esc)', // Alt text on close button + tLoading: 'Загрузка...', // Text that is displayed during loading. Can contain %curr% and %total% keys + ajax: { + tError: 'Контент не загружен.' // Error message when ajax request failed + } + }); + + $('[data-mfp-src]').magnificPopup({ + type: 'inline', + preloader: true, + modal: true, + callbacks: { + open: function() { + doc.trigger('mapInit'); + } + } + }); +}); // ready diff --git a/upload/engine/ajax/ymaps/all.php b/upload/engine/ajax/ymaps/all.php deleted file mode 100644 index 3eafbdf..0000000 --- a/upload/engine/ajax/ymaps/all.php +++ /dev/null @@ -1,293 +0,0 @@ - - * @link https://git.io/v9irg - */ - -// Всякие обязательные штуки для ajax DLE -@error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE); -@ini_set('display_errors', true); -@ini_set('html_errors', false); -@ini_set('error_reporting', E_ALL ^ E_WARNING ^ E_NOTICE); - -define('DATALIFEENGINE', true); -define('ROOT_DIR', substr(dirname(__FILE__), 0, -18)); - -define('ENGINE_DIR', ROOT_DIR . '/engine'); - -$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); - -define('MODULE_DIR', ENGINE_DIR . '/modules/' . $cfg['moduleName'] . '/'); - -include_once ENGINE_DIR . '/plugins/loader/loader.php'; - -if (@file_exists(MODULE_DIR . '/language/' . $cfg['main']['moduleLang'] . '.lng')) { - include(DLEPlugins::Check(MODULE_DIR . '/language/' . $cfg['main']['moduleLang'] . '.lng')); -} else { - die("Language file not found"); -} - - -include (DLEPlugins::Check(ENGINE_DIR . '/data/config.php')); - -require_once (DLEPlugins::Check(ENGINE_DIR . '/classes/mysql.php')); -require_once (DLEPlugins::Check(ENGINE_DIR . '/data/dbconfig.php')); -require_once (DLEPlugins::Check(ENGINE_DIR . '/modules/functions.php')); -if ($config['version_id'] > 9.6) { - dle_session(); -} else { - @session_start(); -} - - -$user_group = get_vars("usergroup"); -if (!$user_group) { - $user_group = []; - $db->query("SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC"); - while ($row = $db->get_row()) { - $user_group[$row['id']] = []; - foreach ($row as $key => $value) $user_group[$row['id']][$key] = stripslashes($value); - } - set_vars("usergroup", $user_group); - $db->free(); -} - -$cat_info = get_vars("category"); - -if (!is_array($cat_info)) { - $cat_info = []; - - $db->query("SELECT * FROM " . PREFIX . "_category ORDER BY posi ASC"); - while ($row = $db->get_row()) { - - $cat_info[$row['id']] = []; - - foreach ($row as $key => $value) { - $cat_info[$row['id']][$key] = stripslashes($value); - } - - } - set_vars("category", $cat_info); - $db->free(); -} -$template_dir = ROOT_DIR . '/templates/' . $config['skin']; - -// Пытаемся получить даные из шаблона с настройками -if ($_REQUEST['preset'] && file_exists($template_dir . '/' . $cfg['moduleName'] . '/all/' . $_REQUEST['preset'] . '.tpl')) { - // Если файл существует - берём из него контент с настройками - $preset = file_get_contents($template_dir . '/' . $cfg['moduleName'] . '/all/' . $_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 = [// 'template' => !empty($template) ? $template : $cfg['moduleName'] . '/all/default', - '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 - * - * @internal param string $diapasone - * @return string - * @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/upload/engine/ajax/ymaps/cat.php b/upload/engine/ajax/ymaps/cat.php deleted file mode 100644 index 1b5b69d..0000000 --- a/upload/engine/ajax/ymaps/cat.php +++ /dev/null @@ -1,301 +0,0 @@ - - * @link https://git.io/v9irg - */ - -// Всякие обязательные штуки для ajax DLE -@error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE); -@ini_set('display_errors', true); -@ini_set('html_errors', false); -@ini_set('error_reporting', E_ALL ^ E_WARNING ^ E_NOTICE); - -define('DATALIFEENGINE', true); -define('ROOT_DIR', substr(dirname(__FILE__), 0, -18)); - -define('ENGINE_DIR', ROOT_DIR . '/engine'); - -$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); - -define('MODULE_DIR', ENGINE_DIR . '/modules/' . $cfg['moduleName'] . '/'); - -include_once ENGINE_DIR . '/plugins/loader/loader.php'; - -if (@file_exists(MODULE_DIR . '/language/' . $cfg['main']['moduleLang'] . '.lng')) { - include(DLEPlugins::Check(MODULE_DIR . '/language/' . $cfg['main']['moduleLang'] . '.lng')); -} else { - die("Language file not found"); -} - - -include (DLEPlugins::Check(ENGINE_DIR . '/data/config.php')); - -require_once (DLEPlugins::Check(ENGINE_DIR . '/classes/mysql.php')); -require_once (DLEPlugins::Check(ENGINE_DIR . '/data/dbconfig.php')); -require_once (DLEPlugins::Check(ENGINE_DIR . '/modules/functions.php')); -if ($config['version_id'] > 9.6) { - dle_session(); -} else { - @session_start(); -} - - -$user_group = get_vars("usergroup"); -if (!$user_group) { - $user_group = []; - $db->query("SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC"); - while ($row = $db->get_row()) { - $user_group[$row['id']] = []; - foreach ($row as $key => $value) $user_group[$row['id']][$key] = stripslashes($value); - } - set_vars("usergroup", $user_group); - $db->free(); -} - -$cat_info = get_vars("category"); - -if (!is_array($cat_info)) { - $cat_info = []; - - $db->query("SELECT * FROM " . PREFIX . "_category ORDER BY posi ASC"); - while ($row = $db->get_row()) { - - $cat_info[$row['id']] = []; - - foreach ($row as $key => $value) { - $cat_info[$row['id']][$key] = stripslashes($value); - } - - } - set_vars("category", $cat_info); - $db->free(); -} -$template_dir = ROOT_DIR . '/templates/' . $config['skin']; - -// Пытаемся получить даные из шаблона с настройками -if ($_REQUEST['preset'] && file_exists($template_dir . '/' . $cfg['moduleName'] . '/all/' . $_REQUEST['preset'] . '.tpl')) { - // Если файл существует - берём из него контент с настройками - $preset = file_get_contents($template_dir . '/' . $cfg['moduleName'] . '/all/' . $_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 = [// 'template' => !empty($template) ? $template : $cfg['moduleName'] . '/all/default', - '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($_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 - * - * @internal param string $diapasone - * @return string - * @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/upload/engine/ajax/ymaps/check_status.php b/upload/engine/ajax/ymaps/check_status.php deleted file mode 100644 index dd2a9d0..0000000 --- a/upload/engine/ajax/ymaps/check_status.php +++ /dev/null @@ -1,9 +0,0 @@ - - * @link https://git.io/v9irg - */ - -die ('License activation is not required'); \ No newline at end of file diff --git a/upload/engine/ajax/ymaps/check_updates.php b/upload/engine/ajax/ymaps/check_updates.php deleted file mode 100644 index 7f14761..0000000 --- a/upload/engine/ajax/ymaps/check_updates.php +++ /dev/null @@ -1,9 +0,0 @@ - - * @link https://git.io/v9irg - */ - -die (''); \ No newline at end of file diff --git a/upload/engine/ajax/ymaps/editmarker.php b/upload/engine/ajax/ymaps/editmarker.php deleted file mode 100644 index 8941c06..0000000 --- a/upload/engine/ajax/ymaps/editmarker.php +++ /dev/null @@ -1,232 +0,0 @@ - - * @link https://git.io/v9irg - */ - -// Всякие обязательные штуки для ajax DLE -@error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE); -@ini_set('display_errors', true); -@ini_set('html_errors', false); -@ini_set('error_reporting', E_ALL ^ E_WARNING ^ E_NOTICE); - -define('DATALIFEENGINE', true); -define('ROOT_DIR', substr(dirname(__FILE__), 0, -18)); - -define('ENGINE_DIR', ROOT_DIR . '/engine'); - -$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); - -define('MODULE_DIR', ENGINE_DIR . '/modules/' . $cfg['moduleName'] . '/'); - -include_once ENGINE_DIR . '/plugins/loader/loader.php'; - -if (@file_exists(MODULE_DIR . '/language/' . $cfg['main']['moduleLang'] . '.lng')) { - include(DLEPlugins::Check(MODULE_DIR . '/language/' . $cfg['main']['moduleLang'] . '.lng')); -} else { - die("Language file not found"); -} - - -include (DLEPlugins::Check(ENGINE_DIR . '/data/config.php')); - -require_once (DLEPlugins::Check(ENGINE_DIR . '/classes/mysql.php')); -require_once (DLEPlugins::Check(ENGINE_DIR . '/data/dbconfig.php')); -require_once (DLEPlugins::Check(ENGINE_DIR . '/modules/functions.php')); -if ($config['version_id'] > 9.6) { - dle_session(); -} else { - @session_start(); -} - - -$user_group = get_vars("usergroup"); -if (!$user_group) { - $user_group = []; - $db->query("SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC"); - while ($row = $db->get_row()) { - $user_group[$row['id']] = []; - foreach ($row as $key => $value) $user_group[$row['id']][$key] = stripslashes($value); - } - set_vars("usergroup", $user_group); - $db->free(); -} - -$cat_info = get_vars("category"); - -if (!is_array($cat_info)) { - $cat_info = []; - - $db->query("SELECT * FROM " . PREFIX . "_category ORDER BY posi ASC"); - while ($row = $db->get_row()) { - - $cat_info[$row['id']] = []; - - foreach ($row as $key => $value) { - $cat_info[$row['id']][$key] = stripslashes($value); - } - - } - set_vars("category", $cat_info); - $db->free(); -} - -function showCustomIconList($id = 0) { - global $config, $cfg; - - $arImages = []; - $tplPiconPath = 'templates/' . $config['skin'] . '/' . $cfg['moduleName'] . '/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[] = ''; - - } - - return implode("\n", $option); -} - -require_once ENGINE_DIR . '/modules/sitelogin.php'; -require_once MODULE_DIR . 'admin/classes/xfields.php'; - - -/** - * Основной код файла - */ - -if ($member_id['user_group'] == '1') { - - 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[] = ''; - } - $optionsCustomIcons = implode("\n", $optionsCustomIcons); - - $customSelect = ($cfg['pointSettings']['catPoints'][$arCat['id']]['iconLayout']) ? 'selected' : ''; - - $showResult = '
    -
    - -
    -
    '; - } else { - $showResult = '
    - -
    '; - } - - die ($showResult); -} else { - die ('Access denied'); -} - diff --git a/upload/engine/ajax/ymaps/editnews.php b/upload/engine/ajax/ymaps/editnews.php deleted file mode 100644 index b8246b7..0000000 --- a/upload/engine/ajax/ymaps/editnews.php +++ /dev/null @@ -1,220 +0,0 @@ - - * @link https://git.io/v9irg - */ - -// Всякие обязательные штуки для ajax DLE -@error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE); -@ini_set('display_errors', true); -@ini_set('html_errors', false); -@ini_set('error_reporting', E_ALL ^ E_WARNING ^ E_NOTICE); - -define('DATALIFEENGINE', true); -define('ROOT_DIR', substr(dirname(__FILE__), 0, -18)); - -define('ENGINE_DIR', ROOT_DIR . '/engine'); - -$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); - -define('MODULE_DIR', ENGINE_DIR . '/modules/' . $cfg['moduleName'] . '/'); - -include_once ENGINE_DIR . '/plugins/loader/loader.php'; - -if (@file_exists(MODULE_DIR . '/language/' . $cfg['main']['moduleLang'] . '.lng')) { - include(DLEPlugins::Check(MODULE_DIR . '/language/' . $cfg['main']['moduleLang'] . '.lng')); -} else { - die("Language file not found"); -} - - -include (DLEPlugins::Check(ENGINE_DIR . '/data/config.php')); - -require_once (DLEPlugins::Check(ENGINE_DIR . '/classes/mysql.php')); -require_once (DLEPlugins::Check(ENGINE_DIR . '/data/dbconfig.php')); -require_once (DLEPlugins::Check(ENGINE_DIR . '/modules/functions.php')); -if ($config['version_id'] > 9.6) { - dle_session(); -} else { - @session_start(); -} - - -$user_group = get_vars("usergroup"); -if (!$user_group) { - $user_group = []; - $db->query("SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC"); - while ($row = $db->get_row()) { - $user_group[$row['id']] = []; - foreach ($row as $key => $value) $user_group[$row['id']][$key] = stripslashes($value); - } - set_vars("usergroup", $user_group); - $db->free(); -} - -$cat_info = get_vars("category"); - -if (!is_array($cat_info)) { - $cat_info = []; - - $db->query("SELECT * FROM " . PREFIX . "_category ORDER BY posi ASC"); - while ($row = $db->get_row()) { - - $cat_info[$row['id']] = []; - - foreach ($row as $key => $value) { - $cat_info[$row['id']][$key] = stripslashes($value); - } - - } - set_vars("category", $cat_info); - $db->free(); -} - - -$key = ($cfg->apiKey) ? '&key=' . $cfg->apiKey : ''; - -$ymaps = ''; -$ymaps .= ''; -// $ymaps .= ''; - -$mapHeight = ($cfg['main']['mapHeight']) ? $cfg['main']['mapHeight'] : '400'; -$controls = $cfg['main']['controls']; -$controls = array_keys($controls); -$controls = json_encode($controls); -$arPlacemarkStyles = ($cfg['pointSettings']['catPoints']) ? json_encode($cfg['pointSettings']['catPoints']) : '{}'; - - -$ymaps .= << - var pointInput = $('[name="xfield[{$cfg['main']['coordsField']}]"]'), - coor = getCorrsFromInput(pointInput), - coordsFieldText; - - - var lon = coor.lon, - lat = coor.lat, - zoom = coor.zoom, - controls = $.parseJSON('{$controls}'), - height = {$cfg['main']['mapHeight']}; - - - function hideCoordsField() { - if (pointInput.length) { - var editPlacemarkText = (pointInput.val()) ? '{$module_lang['moduleTextEditPlacemark']}' : '{$module_lang['moduleTextAddPlacemark']}' ; - if ($('[data-mfp-src="#addMap"]').length < 1) { - pointInput.hide().after(''+editPlacemarkText+' ×'); - } else { - $('.btn-editmap-modal').text(editPlacemarkText); - } - }; - - - } - - function getCorrsFromInput() { - if (pointInput.val()) { - return $.parseJSON(pointInput.val()); - } else { - return {"lat":"{$cfg['main']['mapCenter']['latitude']}","lon":"{$cfg['main']['mapCenter']['longitude']}","zoom":"{$cfg['main']['mapCenter']['zoom']}"}; - } - } - - function setCenter(coords, zoom) { - var inpText = '{"lat":"'+coords[0].toPrecision(6)+'", "lon" : "'+coords[1].toPrecision(6)+'", "zoom": "'+zoom+'"}'; - coordsFieldText = inpText; - } - function clearPlacemark() { - pointInput.val(''); - } - - function editMapInit() { - var editnewsMap, - myPlacemark; - - $(document) - .on('editMapInit', function() { - - var map = $('#map'), - coor = getCorrsFromInput(), - lon = coor.lon, - lat = coor.lat, - zoom = coor.zoom; - - map.height(height); - - if (editnewsMap) { - myPlacemark = false; - editnewsMap.events.remove(['click','boundschange','dragend']); - editnewsMap.destroy(); - }; - - - editnewsMap = new ymaps.Map('map', { - center: [lat, lon], - zoom: zoom, - controls: controls - }); - - if (pointInput.val()) { - var _coords = $.parseJSON(pointInput.val()); - myPlacemark = createPlacemark([_coords.lat*1, _coords.lon*1]); - - editnewsMap.geoObjects.add(myPlacemark); - }; - - // Слушаем клик на карте - editnewsMap.events - .add('click', function (e) { - var coords = e.get('coords'); - // Если метка уже создана – просто передвигаем ее - if (myPlacemark) { - myPlacemark.geometry.setCoordinates(coords); - } - // Если нет – создаем. - else { - myPlacemark = createPlacemark(coords); - editnewsMap.geoObjects.add(myPlacemark); - - // Слушаем событие окончания перетаскивания на метке. - myPlacemark.events.add('dragend', function () { - setCenter(myPlacemark.geometry.getCoordinates(), editnewsMap.getZoom()); - }); - } - setCenter(coords, editnewsMap.getZoom()); - }) - .add('boundschange', function (e) { - setCenter([lat*1, lon*1], editnewsMap.getZoom()); - }); - - // Создание метки - function createPlacemark(coords) { - var arPlacemarkStyles = '{$arPlacemarkStyles}', - categoryId = ($('#category').length) ? $('#category option:selected').val() : 0, - key = (categoryId > 0) ? categoryId : 'default', - placemarkStyle = $.parseJSON(arPlacemarkStyles); - - return new ymaps.Placemark(coords, {}, - placemarkStyle[key] - ); - } - }); - }; - - -
    - -
    -HTML; - - -echo $ymaps; \ No newline at end of file diff --git a/upload/engine/ajax/ymaps/saveconfig.php b/upload/engine/ajax/ymaps/saveconfig.php deleted file mode 100644 index 3d101a0..0000000 --- a/upload/engine/ajax/ymaps/saveconfig.php +++ /dev/null @@ -1,85 +0,0 @@ - - * @link https://git.io/v9irg - */ - -// Всякие обязательные штуки для ajax DLE -@error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE); -@ini_set('display_errors', true); -@ini_set('html_errors', false); -@ini_set('error_reporting', E_ALL ^ E_WARNING ^ E_NOTICE); - -define('DATALIFEENGINE', true); -define('ROOT_DIR', substr(dirname(__FILE__), 0, -18)); - -define('ENGINE_DIR', ROOT_DIR . '/engine'); - -$cfg = json_decode(file_get_contents(ENGINE_DIR . '/data/ymaps_config.json'), true); - -define('MODULE_DIR', ENGINE_DIR . '/modules/' . $cfg['moduleName'] . '/'); - -include_once ENGINE_DIR . '/plugins/loader/loader.php'; - -include (DLEPlugins::Check(ENGINE_DIR . '/data/config.php')); - -require_once (DLEPlugins::Check(ENGINE_DIR . '/classes/mysql.php')); -require_once (DLEPlugins::Check(ENGINE_DIR . '/data/dbconfig.php')); -require_once (DLEPlugins::Check(ENGINE_DIR . '/modules/functions.php')); -if ($config['version_id'] > 9.6) { - dle_session(); -} else { - @session_start(); -} - -$user_group = get_vars("usergroup"); -if (!$user_group) { - $user_group = []; - $db->query("SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC"); - while ($row = $db->get_row()) { - $user_group[$row['id']] = []; - foreach ($row as $key => $value) $user_group[$row['id']][$key] = stripslashes($value); - } - set_vars("usergroup", $user_group); - $db->free(); -} -require_once ENGINE_DIR . '/modules/sitelogin.php'; - -/** - * Основной код файла - */ -if ($member_id['user_group'] == '1') { - - 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; - } - // echo "
    "; print_r($_POST); echo "
    "; - // die (); - - $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/upload/engine/ajax/ymaps/xfields.php b/upload/engine/ajax/ymaps/xfields.php deleted file mode 100644 index 88ef309..0000000 --- a/upload/engine/ajax/ymaps/xfields.php +++ /dev/null @@ -1,95 +0,0 @@ - - * @link https://git.io/v9irg - */ - -// Всякие обязательные штуки для ajax DLE -@error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE); -@ini_set('display_errors', true); -@ini_set('html_errors', false); -@ini_set('error_reporting', E_ALL ^ E_WARNING ^ E_NOTICE); - -define('DATALIFEENGINE', true); -define('ROOT_DIR', substr(dirname(__FILE__), 0, -18)); - -define('ENGINE_DIR', ROOT_DIR . '/engine'); - -$cfg = json_decode(file_get_contents(ENGINE_DIR . '/data/ymaps_config.json'), true); - -define('MODULE_DIR', ENGINE_DIR . '/modules/' . $cfg['moduleName'] . '/'); - -include_once ENGINE_DIR . '/plugins/loader/loader.php'; - -if (@file_exists(MODULE_DIR . '/language/' . $cfg['main']['moduleLang'] . '.lng')) { - include(DLEPlugins::Check(MODULE_DIR . '/language/' . $cfg['main']['moduleLang'] . '.lng')); -} else { - die("Language file not found"); -} - - -include (DLEPlugins::Check(ENGINE_DIR . '/data/config.php')); - -require_once (DLEPlugins::Check(ENGINE_DIR . '/classes/mysql.php')); -require_once (DLEPlugins::Check(ENGINE_DIR . '/data/dbconfig.php')); -require_once (DLEPlugins::Check(ENGINE_DIR . '/modules/functions.php')); -if ($config['version_id'] > 9.6) { - dle_session(); -} else { - @session_start(); -} - - -$user_group = get_vars("usergroup"); -if (!$user_group) { - $user_group = []; - $db->query("SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC"); - while ($row = $db->get_row()) { - $user_group[$row['id']] = []; - foreach ($row as $key => $value) $user_group[$row['id']][$key] = stripslashes($value); - } - set_vars("usergroup", $user_group); - $db->free(); -} -require_once ENGINE_DIR . '/modules/sitelogin.php'; -require_once MODULE_DIR . 'admin/classes/xfields.php'; - - -/** - * Основной код файла - */ - -if ($member_id['user_group'] == '1') { - $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/inc/ymaps.php b/upload/engine/inc/ymaps.php deleted file mode 100644 index cde5b24..0000000 --- a/upload/engine/inc/ymaps.php +++ /dev/null @@ -1,118 +0,0 @@ - - * @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/' . $cfg->moduleName . '/'); - -if (@file_exists(MODULE_DIR . '/language/' . $cfg->main->moduleLang . '.lng')) { - include(MODULE_DIR . '/language/' . $cfg->main->moduleLang . '.lng'); -} else { - die("Language file not found"); -} - -include(MODULE_DIR . 'admin/classes/xfields.php'); - -?> - - - - - <?= $cfg->moduleTitle ?> - <?= $module_lang['moduleTextManagment'] ?> - - - - - - - - - - - - - - - -
    -
    -
    - - - -
    -
    - (' . $user_group[$member_id['user_group']]['group_name'] . ') ' ?> - -
    -
    -
    -
    -
    -
    -

    moduleTitle ?> - - v.moduleVersion ?> moduleDate ?> - -

    -
    -
    -
    -
    -
    -
    -
    -
    -
      -
    • -
    • -
    • -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    - DLE-YandexMaps
    -
    -
    -
    -
    - - diff --git a/upload/engine/modules/ymaps/addnews-inline.php b/upload/engine/modules/ymaps/addnews-inline.php deleted file mode 100644 index d515569..0000000 --- a/upload/engine/modules/ymaps/addnews-inline.php +++ /dev/null @@ -1,71 +0,0 @@ - - * @link https://git.io/v9irg - */ - -if (!defined('DATALIFEENGINE')) { - die("Go fuck yourself!"); -} - -$cfg = json_decode(file_get_contents(ENGINE_DIR . '/data/ymaps_config.json')); - -define('MODULE_DIR', ENGINE_DIR . '/modules/' . $cfg->moduleName . '/'); - -define('MODULE_DIR', ENGINE_DIR . '/modules/' . $cfg->moduleName . '/'); - -if (@file_exists(MODULE_DIR . '/language/' . $cfg->main->moduleLang . '.lng')) { - include(MODULE_DIR . '/language/' . $cfg->main->moduleLang . '.lng'); -} else { - die("Language file not found"); -} - -$key = ($cfg->apiKey) ? '&key=' . $cfg->apiKey : ''; - -$ymaps = ''; -$ymaps .= ''; - -$mapHeight = ($cfg->main->mapHeight) ? $cfg->main->mapHeight : '400'; -$controls = (array)$cfg->main->controls; -$controls = array_keys($controls); -$controls = json_encode($controls); - -$ymaps .= << - var arPlacemarkStyles = '{$arPlacemarkStyles}', - inputSelector = '[name="xfield[{$cfg->main->coordsField}]"]', - controls = $.parseJSON('{$controls}'), - height = {$cfg->main->mapHeight}, - coordsFieldText; - - function hideCoordsField(but) { - if ($('#xfield_holder_{$cfg->main->coordsField}').css('display') != 'none') { - $('#xfield_holder_{$cfg->main->coordsField}').hide(); - $(but).show(); - } else { - $(but).hide(); - } - } - - function getCorrsFromInput() { - var pointInput = $(inputSelector); - if (pointInput.val()) { - return $.parseJSON(pointInput.val()); - } else { - return {"lat":"{$cfg->main->mapCenter->latitude}","lon":"{$cfg->main->mapCenter->longitude}","zoom":"{$cfg->main->mapCenter->zoom}"}; - } - } - - function setCenter(coords, zoom) { - var inpText = '{"lat":"'+coords[0].toPrecision(6)+'", "lon" : "'+coords[1].toPrecision(6)+'", "zoom": "'+zoom+'"}'; - $('[name="xfield[{$cfg->main->coordsField}]"]').val(inpText); - } - - -
    -HTML; - - -echo $ymaps; \ No newline at end of file diff --git a/upload/engine/modules/ymaps/addnews.php b/upload/engine/modules/ymaps/addnews.php deleted file mode 100644 index 7c02d6d..0000000 --- a/upload/engine/modules/ymaps/addnews.php +++ /dev/null @@ -1,95 +0,0 @@ - - * @link https://git.io/v9irg - */ - -if (!defined('DATALIFEENGINE')) { - die("Go fuck yourself!"); -} - -$cfg = json_decode(file_get_contents(ENGINE_DIR . '/data/ymaps_config.json')); - -define('MODULE_DIR', ENGINE_DIR . '/modules/' . $cfg->moduleName . '/'); - -define('MODULE_DIR', ENGINE_DIR . '/modules/' . $cfg->moduleName . '/'); - -if (@file_exists(MODULE_DIR . '/language/' . $cfg->main->moduleLang . '.lng')) { - include(MODULE_DIR . '/language/' . $cfg->main->moduleLang . '.lng'); -} else { - die("Language file not found"); -} - -$key = ($cfg->apiKey) ? '&key=' . $cfg->apiKey : ''; - -$ymaps = ''; -$ymaps .= ''; -$ymaps .= ''; - -$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) : '{}'; - -$ymaps .= << - var arPlacemarkStyles = '{$arPlacemarkStyles}', - inputSelector = '[name="xfield[{$cfg->main->coordsField}]"]', - controls = $.parseJSON('{$controls}'), - height = {$cfg->main->mapHeight}, - coordsFieldText; - - function hideCoordsField(but) { - if ($('#xfield_holder_{$cfg->main->coordsField}').css('display') != 'none') { - $('#xfield_holder_{$cfg->main->coordsField}').hide(); - $(but).show(); - } else { - $(but).hide(); - } - } - - function getCorrsFromInput() { - var pointInput = $(inputSelector); - if (pointInput.val()) { - return $.parseJSON(pointInput.val()); - } else { - return {"lat":"{$cfg->main->mapCenter->latitude}","lon":"{$cfg->main->mapCenter->longitude}","zoom":"{$cfg->main->mapCenter->zoom}"}; - } - } - - function setCenter(coords, zoom) { - var inpText = '{"lat":"'+coords[0].toPrecision(6)+'", "lon" : "'+coords[1].toPrecision(6)+'", "zoom": "'+zoom+'"}'; - coordsFieldText = inpText; - } - - function applyCoords() { - $(inputSelector).val(coordsFieldText); - } - - function resetCoords() { - $(inputSelector).val(''); - } - - function getInput() { - return $(inputSelector).val(); - } - - - -
    - -
    -HTML; - - -echo $ymaps; \ No newline at end of file diff --git a/upload/engine/modules/ymaps/detail.php b/upload/engine/modules/ymaps/detail.php deleted file mode 100644 index 7642b4d..0000000 --- a/upload/engine/modules/ymaps/detail.php +++ /dev/null @@ -1,378 +0,0 @@ - - * @link https://git.io/v9irg - */ - -if (!defined('DATALIFEENGINE')) { - die("Go fuck yourself!"); -} - -$cfg = json_decode(file_get_contents(ENGINE_DIR . '/data/ymaps_config.json')); - -define('MODULE_DIR', ENGINE_DIR . '/modules/' . $cfg->moduleName . '/'); - -if (@file_exists(MODULE_DIR . '/language/' . $cfg->main->moduleLang . '.lng')) { - include(MODULE_DIR . '/language/' . $cfg->main->moduleLang . '.lng'); -} else { - die("Language file not found"); -} - -// Список разрешенных полей, отбираемых из БД. -$existFields = ['title', 'short_story', 'full_story']; - -// Конфиг модуля -$yMapCfg = ['cachePrefix' => !empty($arConf['cachePrefix']) ? $arConf['cachePrefix'] : 'full_' . (int)$_REQUEST['newsid'] . '_ym', 'id' => (!empty($id)) ? (int)$id : false, 'template' => !empty($template) ? $template : $cfg->moduleName . '/default', 'fields' => $fields]; -$cacheName = md5(implode('_', $yMapCfg)) . $config['skin']; -$yMap = false; -$yMap = dle_cache($yMapCfg['cachePrefix'], $cacheName . $config['skin'], true); -if (!$yMap) { - - // Поля, которые отбираются из БД в любом случае - $_queryFields = ['id', 'category', 'xfields', 'approve']; - - // убираем пробелы, на всякий случай - $fields = str_replace(' ', '', $fields); - - // Разбиваем поля на массив - $_fields = explode(',', $fields); - - // Сравниваем со списком разрешенных полей - foreach ($_fields as $key => $field) { - if (!in_array($field, $existFields)) { - // Удаляем лишние поля из массива - unset($_fields[$key]); - } - } - - // Объединяем массивы - $arQueryFields = array_merge($_queryFields, $_fields); - - // И опять разбиваем, для вставки в запрос. - $queryFields = implode(', ', $arQueryFields); - - // API-key - $key = ($cfg->main->apiKey) ? '&key=' . $cfg->main->apiKey : ''; - - - $mapHeight = ($cfg->main->mapHeight) ? $cfg->main->mapHeight : '400'; - $controls = (array)$cfg->main->controls; - $controls = array_keys($controls); - $controls = json_encode($controls); - - if (file_exists(TEMPLATE_DIR . '/' . $yMapCfg['template'] . '.tpl')) { - - $tpl->load_template($yMapCfg['template'] . '.tpl'); - - if ($yMapCfg['id'] > 0) { - $row = $db->super_query("SELECT " . $queryFields . " FROM " . PREFIX . "_post WHERE id = " . $yMapCfg['id']); - - $catPoints = $cfg->pointSettings->catPoints; - $_catId = intval($row['category']); - - $catPoint = ($catPoints->$_catId) ? $_catId : 'default'; - $placemarkStyle = (array)$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]; - } - - $placemarkStyle = json_encode($placemarkStyle); - - $tpl->set('{placemarkStyle}', $placemarkStyle); - - if ($row['date']) { - $row['date'] = strtotime($row['date']); - } - if ($row['short_story']) { - $row['short_story'] = stripslashes($row['short_story']); - } - if ($row['full_story']) { - $row['full_story'] = stripslashes($row['full_story']); - } - - if ($row['category']) { - $my_cat = []; - $my_cat_link = []; - $cat_list = explode(',', $row['category']); - - $config['category_separator'] = ($config['category_separator'] != ',') ? ' ' . $config['category_separator'] : ', '; - - if (count($cat_list) == 1) { - $my_cat[] = $cat_info[$cat_list[0]]['name']; - $my_cat_link = get_categories($cat_list[0], $config['category_separator']); - } else { - foreach ($cat_list as $element) { - if ($element) { - $my_cat[] = $cat_info[$element]['name']; - if ($config['allow_alt_url']) { - $my_cat_link[] = "{$cat_info[$element]['name']}"; - } else { - $my_cat_link[] = "{$cat_info[$element]['name']}"; - } - } - } - $my_cat_link = implode("{$config['category_separator']} ", $my_cat_link); - } - $my_cat = implode("{$config['category_separator']} ", $my_cat); - } - if ($row['title']) { - $row['title'] = strip_tags($row['title']); - } - - $xf = xfieldsdataload($row['xfields']); - - $xfCo_ = html_entity_decode($xf[$cfg->main->coordsField], ENT_COMPAT); - - $xfCoords = json_decode($xfCo_); - - $lon = ($xfCoords->lon) ? $xfCoords->lon : $cfg->main->mapCenter->longitude; - $lat = ($xfCoords->lat) ? $xfCoords->lat : $cfg->main->mapCenter->latitude; - $zoom = ($xfCoords->zoom) ? $xfCoords->zoom : $cfg->main->mapCenter->zoom; - - } else { - die('empty news id'); - } - - $script_yandex = ''; - $script_popup = ''; - $script_module = ''; - - $tpl->set('{key}', $key); - - $tpl->set('{scripts}', $script_yandex . $script_popup . $script_module); - $tpl->set('{script_yandex}', $script_yandex); - $tpl->set('{script_popup}', $script_popup); - $tpl->set('{script_module}', $script_module); - - $tpl->set('{lon}', $lon); - $tpl->set('{lat}', $lat); - $tpl->set('{zoom}', $zoom); - $tpl->set('{mapHeight}', $mapHeight); - $tpl->set('{controls}', $controls); - $tpl->set('{placemarkStyle}', $placemarkStyle); - $tpl->set('{baloon}', ''); - $tpl->set('{id}', $row['id']); - - - // Определяем список тегов, используемых в шаблоне на основании массива с данными о разрешенных полях - foreach ($existFields as $field) { - - if ($row[$field]) { - $tpl->set('{' . $field . '}', $row[$field]); - $tpl->copy_template = preg_replace("'\\[not_" . $field . "\\](.*?)\\[/not_" . $field . "\\]'is", "", $tpl->copy_template); - $tpl->copy_template = str_replace("[" . $field . "]", "", $tpl->copy_template); - $tpl->copy_template = str_replace("[/" . $field . "]", "", $tpl->copy_template); - } else { - $tpl->set('{' . $field . '}', ""); - $tpl->copy_template = preg_replace("'\\[" . $field . "\\](.*?)\\[/" . $field . "\\]'is", "", $tpl->copy_template); - $tpl->copy_template = str_replace("[not_" . $field . "]", "", $tpl->copy_template); - $tpl->copy_template = str_replace("[/not_" . $field . "]", "", $tpl->copy_template); - } - } - - // Работаем с допполями - if (strpos($tpl->copy_template, "[xfvalue_") !== false OR strpos($tpl->copy_template, "[xfgiven_") !== false) { - - $xfieldsdata = $xf; - $xfields = xfieldsload(); - foreach ($xfields as $value) { - $preg_safe_name = preg_quote($value[0], "'"); - - if ($value[6] AND !empty($xfieldsdata[$value[0]])) { - $temp_array = explode(",", $xfieldsdata[$value[0]]); - $value3 = []; - - foreach ($temp_array as $value2) { - - $value2 = trim($value2); - $value2 = str_replace("'", "'", $value2); - - if ($config['allow_alt_url']) { - $value3[] = "" . $value2 . ""; - } else { - $value3[] = "" . $value2 . ""; - } - } - - $xfieldsdata[$value[0]] = implode(", ", $value3); - - unset($temp_array); - unset($value2); - unset($value3); - - } - - if (empty($xfieldsdata[$value[0]])) { - $tpl->copy_template = preg_replace("'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template); - $tpl->copy_template = str_replace("[xfnotgiven_{$value[0]}]", "", $tpl->copy_template); - $tpl->copy_template = str_replace("[/xfnotgiven_{$value[0]}]", "", $tpl->copy_template); - } else { - $tpl->copy_template = preg_replace("'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template); - $tpl->copy_template = str_replace("[xfgiven_{$value[0]}]", "", $tpl->copy_template); - $tpl->copy_template = str_replace("[/xfgiven_{$value[0]}]", "", $tpl->copy_template); - } - - $xfieldsdata[$value[0]] = stripslashes($xfieldsdata[$value[0]]); - - if ($config['allow_links'] AND $value[3] == "textarea" AND function_exists('replace_links')) { - $xfieldsdata[$value[0]] = replace_links($xfieldsdata[$value[0]], $replace_links['news']); - } - - $tpl->copy_template = str_replace("[xfvalue_{$value[0]}]", $xfieldsdata[$value[0]], $tpl->copy_template); - - if (preg_match("#\\[xfvalue_{$preg_safe_name} limit=['\"](.+?)['\"]\\]#i", $tpl->copy_template, $matches)) { - $count = intval($matches[1]); - - $xfieldsdata[$value[0]] = str_replace("

    ", " ", $xfieldsdata[$value[0]]); - $xfieldsdata[$value[0]] = strip_tags($xfieldsdata[$value[0]], "
    "); - $xfieldsdata[$value[0]] = trim(str_replace("
    ", " ", str_replace("
    ", " ", str_replace("\n", " ", str_replace("\r", "", $xfieldsdata[$value[0]]))))); - - if ($count AND dle_strlen($xfieldsdata[$value[0]], $config['charset']) > $count) { - - $xfieldsdata[$value[0]] = dle_substr($xfieldsdata[$value[0]], 0, $count, $config['charset']); - - if (($temp_dmax = dle_strrpos($xfieldsdata[$value[0]], ' ', $config['charset']))) { - $xfieldsdata[$value[0]] = dle_substr($xfieldsdata[$value[0]], 0, $temp_dmax, $config['charset']); - } - - } - - $tpl->set($matches[0], $xfieldsdata[$value[0]]); - - } - } - } - - // тянем картинки из краткой новости - if (stripos($tpl->copy_template, "{image-") !== false) { - - $images = []; - preg_match_all('/(img|src)=("|\')[^"\'>]+/i', $row['short_story'], $media); - $data = preg_replace('/(img|src)("|\'|="|=\')(.*)/i', "$3", $media[0]); - - foreach ($data as $url) { - $info = pathinfo($url); - if (isset($info['extension'])) { - if ($info['filename'] == "spoiler-plus" OR $info['filename'] == "spoiler-plus") { - continue; - } - $info['extension'] = strtolower($info['extension']); - if (($info['extension'] == 'jpg') || ($info['extension'] == 'jpeg') || ($info['extension'] == 'gif') || ($info['extension'] == 'png')) { - array_push($images, $url); - } - } - } - - if (count($images)) { - $i = 0; - foreach ($images as $url) { - $i++; - $tpl->copy_template = str_replace('{image-' . $i . '}', $url, $tpl->copy_template); - $tpl->copy_template = str_replace('[image-' . $i . ']', "", $tpl->copy_template); - $tpl->copy_template = str_replace('[/image-' . $i . ']', "", $tpl->copy_template); - } - - } - - $tpl->copy_template = preg_replace("#\[image-(.+?)\](.+?)\[/image-(.+?)\]#is", "", $tpl->copy_template); - $tpl->copy_template = preg_replace("#\\{image-(.+?)\\}#i", "{THEME}/dleimages/no_image.jpg", $tpl->copy_template); - - } - - // тянем картинки из полной новости - if (stripos($tpl->copy_template, "{fullimage-") !== false) { - - $images = []; - preg_match_all('/(img|src)=("|\')[^"\'>]+/i', $row['full_story'], $media); - $data = preg_replace('/(img|src)("|\'|="|=\')(.*)/i', "$3", $media[0]); - - foreach ($data as $url) { - $info = pathinfo($url); - if (isset($info['extension'])) { - if ($info['filename'] == "spoiler-plus" OR $info['filename'] == "spoiler-plus") { - continue; - } - $info['extension'] = strtolower($info['extension']); - if (($info['extension'] == 'jpg') || ($info['extension'] == 'jpeg') || ($info['extension'] == 'gif') || ($info['extension'] == 'png')) { - array_push($images, $url); - } - } - } - - if (count($images)) { - $i = 0; - foreach ($images as $url) { - $i++; - $tpl->copy_template = str_replace('{fullimage-' . $i . '}', $url, $tpl->copy_template); - $tpl->copy_template = str_replace('[fullimage-' . $i . ']', "", $tpl->copy_template); - $tpl->copy_template = str_replace('[/fullimage-' . $i . ']', "", $tpl->copy_template); - } - - } - - $tpl->copy_template = preg_replace("#\[fullimage-(.+?)\](.+?)\[/fullimage-(.+?)\]#is", "", $tpl->copy_template); - $tpl->copy_template = preg_replace("#\\{fullimage-(.+?)\\}#i", "{THEME}/dleimages/no_image.jpg", $tpl->copy_template); - - } - - if (preg_match("#\\{title limit=['\"](.+?)['\"]\\}#i", $tpl->copy_template, $matches)) { - $count = intval($matches[1]); - if ($count AND dle_strlen($row['title'], $config['charset']) > $count) { - $row['title'] = dle_substr($row['title'], 0, $count, $config['charset']); - if (($temp_dmax = dle_strrpos($row['title'], ' ', $config['charset']))) { - $row['title'] = dle_substr($row['title'], 0, $temp_dmax, $config['charset']); - } - } - $tpl->set($matches[0], $row['title']); - } - - if (preg_match("#\\{short_story limit=['\"](.+?)['\"]\\}#i", $tpl->copy_template, $matches)) { - $count = intval($matches[1]); - $row['short_story'] = str_replace("

    ", " ", $row['short_story']); - $row['short_story'] = strip_tags($row['short_story'], "
    "); - $row['short_story'] = trim(str_replace("
    ", " ", str_replace("
    ", " ", str_replace("\n", " ", str_replace("\r", "", $row['short_story']))))); - if ($count AND dle_strlen($row['short_story'], $config['charset']) > $count) { - $row['short_story'] = dle_substr($row['short_story'], 0, $count, $config['charset']); - if (($temp_dmax = dle_strrpos($row['short_story'], ' ', $config['charset']))) { - $row['short_story'] = dle_substr($row['short_story'], 0, $temp_dmax, $config['charset']); - } - } - $tpl->set($matches[0], $row['short_story']); - } - - if (preg_match("#\\{full_story limit=['\"](.+?)['\"]\\}#i", $tpl->copy_template, $matches)) { - $count = intval($matches[1]); - $row['full_story'] = str_replace("

    ", " ", $row['full_story']); - $row['full_story'] = strip_tags($row['full_story'], "
    "); - $row['full_story'] = trim(str_replace("
    ", " ", str_replace("
    ", " ", str_replace("\n", " ", str_replace("\r", "", $row['full_story']))))); - if ($count AND dle_strlen($row['full_story'], $config['charset']) > $count) { - $row['full_story'] = dle_substr($row['full_story'], 0, $count, $config['charset']); - if (($temp_dmax = dle_strrpos($row['full_story'], ' ', $config['charset']))) { - $row['full_story'] = dle_substr($row['full_story'], 0, $temp_dmax, $config['charset']); - } - } - $tpl->set($matches[0], $row['full_story']); - - } - - $tpl->compile('yMap'); - $yMap = $tpl->result['yMap']; - - create_cache($yMapCfg['cachePrefix'], $yMap, $cacheName . $config['skin'], true); - - $tpl->clear(); - } else { - $yMap = '' . $module_lang['moduleTextMissedTemplateFile'] . ': ' . $config['skin'] . '/' . $yMapCfg['template'] . '.tpl'; - } - - -} -echo $yMap; \ No newline at end of file diff --git a/upload/engine/modules/ymaps/js/main.js b/upload/engine/modules/ymaps/js/main.js deleted file mode 100644 index 2af0797..0000000 --- a/upload/engine/modules/ymaps/js/main.js +++ /dev/null @@ -1,460 +0,0 @@ -/**! - * DLE-YandexMaps — Бесплатный модуль Яндекс Карт для DLE - * - * @author ПафНутиЙ - * @link https://git.io/v9irg - */ - -var doc = $(document); - -doc - .on('click', '.popup-modal-dismiss', function (e) { - e.preventDefault(); - $.magnificPopup.close(); - }) - .on('click', '.modal-close', function () { - $.magnificPopup.close(); - }) - .on('click', '.map-save', function (event) { - $('#' + $(this).data('id')).trigger('submit'); - }) - .on('click', '.mfp-open-ajax-xf', function () { - var $this = $(this), - itemData = $this.data(), - $inp = $('#' + itemData.id); - if ($this.hasClass('disabled')) { - return false; - } else { - $.magnificPopup.open({ - type: 'ajax', - gallery: { - enabled: false - }, - items: { - src: itemData.mfpSrc - }, - ajax: { - settings: { - data: { - name: $inp.val(), - description: itemData.description, - value: "", - fieldType: itemData.fieldType - } - } - }, - callbacks: { - afterClose: function () { - $('.map-save').trigger('click'); - $this.addClass('disabled'); - } - } - }); - } - }) - .on('change input keyup', '.xf-input', function () { - var $this = $(this), - valLen = $this.val().length; - if (valLen > 2) { - $this.next('span').removeClass('disabled'); - } - if (valLen < 1) { - $this.next('span').addClass('disabled'); - } - }) - .on('click', '.code', function () { - $(this).select(); - }) - // Аякс отправка формы с эффектами - .on('submit', '[data-ajax-submit]', function () { - var $this = $(this), - laddaLoad, - options = { - dataType: 'json', - beforeSubmit: processStartNew, - success: processDoneNew - }; - - $this.ajaxSubmit(options); - - return false; - }) - .on('submit', '[data-ladda-submit]', function (e) { - e.preventDefault(); - - var $this = $(this), - progress = 0, - laddaLoadNew = $this.find('.ladda-button').ladda(); - laddaLoadNew.ladda('start'); - - var interval = setInterval(function () { - progress = Math.min(progress + Math.random() * 0.2, 1); - laddaLoadNew.ladda('setProgress', progress); - - if (progress === 1) { - laddaLoadNew.ladda('stop'); - clearInterval(interval); - $this.removeAttr('data-ladda-submit').submit(); - } - }, 100); - }) - .on('click', '[data-point-change]', function () { - var itemData = $(this).data(); - - $.magnificPopup.open({ - type: 'ajax', - gallery: { - enabled: false - }, - items: { - src: 'engine/ajax/ymaps/editmarker.php' - }, - ajax: { - settings: { - data: { - id: itemData.pointChange - } - } - }, - callbacks: { - afterClose: function () { - // $('.map-save').trigger('click'); - // $this.addClass('disabled'); - }, - ajaxContentAdded: function () { - var $styler = $(this.content).find('.styler'); - if ($styler.length) { - $markerSelect = $('select.marker-select'); - $customMarkerSelect = $('.marker-custom-icon-select-wrapper'); - $styler.styler({ - onFormStyled: function () { - showSelectedPoint($styler); - if ($markerSelect.val() == 'custom') { - $customMarkerSelect.show(); - showSelectedPoint($customMarkerSelect.find('select.styler')); - } - - } - }); - } - - } - } - }); - }) - .on('click', '[data-point-delete]', function () { - var $this = $(this), - itemData = $this.data(), - progress = 0, - laddaLoadNew = $this.ladda(); - laddaLoadNew.ladda('start'); - - $.ajax({ - url: 'engine/ajax/ymaps/saveconfig.php', - type: 'POST', - data: { - pointID: itemData.pointDelete, - deletePoint: 'y' - } - }) - .done(function () { - console.log('done'); - }) - .fail(function () { - console.log('error'); - }).always(function () { - var interval = setInterval(function () { - progress = Math.min(progress + Math.random() * 0.2, 1); - laddaLoadNew.ladda('setProgress', progress); - - if (progress === 1) { - laddaLoadNew.ladda('stop'); - clearInterval(interval); - location.reload(); - } - }, 100); - }); - - /* Act on the event */ - }) - .on('change', 'select.marker-select', function () { - var $this = $(this), - $customMarkerSelect = $('.marker-custom-icon-select-wrapper'); - showSelectedPoint($this); - if ($this.val() == 'custom') { - $customMarkerSelect.show().find('.styler').trigger('refresh'); - showSelectedPoint($customMarkerSelect.find('select.styler')); - } else { - if (!$this.hasClass('marker-custom-icon-select')) { - $customMarkerSelect.hide(); - } - } - }) - .on('change', 'select.marker-custom-icon-select', function () { - // var $option = $(this).find('option:selected'), - // $oData = $option.data(); - // console.log($oData); - }) - .on('input keyup', '.set-icon-color-input', function () { - var $this = $(this), - thisVal = $this.val(); - $('.selected-marker').css('background', thisVal); - - }) - .on('sheckLicenseStatus', function (event) { - var $licenseStatus = $('#licenseStatus'); - $.ajax({ - url: 'engine/ajax/ymaps/check_status.php' - }) - .done(function (data) { - $licenseStatus.html(data); - }) - .fail(function () { - console.log("error"); - }) - .always(function () { - console.log("complete"); - }); - - }); - -// pre-submit callback -function processStartNew(formData, jqForm, options) { - laddaLoadNew = jqForm.find('.ladda-button').ladda(); - laddaLoadNew.ladda('start'); - - return true; -} - -// post-submit callback -function processDoneNew(responseText, statusText, xhr, $form) { - - var formContent = $form.html(), - responseResult = (formContent) ? formContent : responseText; - - var progress = 0; - var interval = setInterval(function () { - progress = Math.min(progress + Math.random() * 0.2, 1); - laddaLoadNew.ladda('setProgress', progress); - - if (progress === 1) { - laddaLoadNew.ladda('stop'); - clearInterval(interval); - // Тут что-то делаем с пришедшими данными - if (statusText == 'success') { - if ($form.data('ajaxSubmit') == 'reload') { - location.reload(); - } - - if ($form.data('ajaxSubmit') != 'noreload' && $form.data('ajaxSubmit') != 'reload') { - $form.html(responseResult); - } - - } - - } - - }, 100); -} - -// Как только будет загружен API и готов DOM, выполняем инициализацию -ymaps.ready(init); - -// Инициализация карты. -function init() { - var demoMap, - myPlacemark, - $lat = $('#mapCenterLat'), - $lon = $('#mapCenterLon'), - $zoom = $('#mapCenterZoom'), - lat = ($lat.val()) ? $lat.val() : '51.5350', - lon = ($lon.val()) ? $lon.val() : '46.0259', - zoom = ($zoom.val()) ? $zoom.val() : '9'; - doc - .on('mapInit', function () { - var controls = [], - height = ($('#mapHeight').val()) ? $('#mapHeight').val() : 400, - $map = $('#map'); - - $map.height(height); - - $.each($('input[name*="controls"]'), function (index, val) { - var $this = $(this), - id = $this.prop('id'); - if ($this.prop('checked')) { - controls.push(id); - } - - }); - if (!demoMap) { - - demoMap = new ymaps.Map('map', { - center: [lat, lon], // Саратов - zoom: zoom, - controls: controls - }); - } - - // Слушаем клик на карте - demoMap.events.add('click', function (e) { - var coords = e.get('coords'); - - // Если метка уже создана – просто передвигаем ее - if (myPlacemark) { - myPlacemark.geometry.setCoordinates(coords); - } - // Если нет – создаем. - else { - myPlacemark = createPlacemark(coords); - demoMap.geoObjects.add(myPlacemark); - // Слушаем событие окончания перетаскивания на метке. - myPlacemark.events.add('dragend', function () { - setCenter(myPlacemark.geometry.getCoordinates(), demoMap.getZoom()); - }); - } - setCenter(coords, demoMap.getZoom()); - }); - - // Создание метки - function createPlacemark(coords) { - return new ymaps.Placemark(coords, - { - preset: 'islands#icon', - draggable: true, - iconColor: '#0095b6' - }); - } - - function setCenter(coords, zoom) { - $lat.val(coords[0].toPrecision(6)); - $lon.val(coords[1].toPrecision(6)); - $zoom.val(zoom); - } - }) - .on('mapDestroy', function () { - /**/ - }); -} - -jQuery(document).ready(function ($) { - - // Авторазмер для блоков с кодом - $('.code').autosize(); - - // Селекты - $('.styler').styler(); - - // Прячем кнопки создания допполей - $.each($('.xf-input'), function () { - if ($(this).val().length) { - $(this).next('span').addClass('disabled'); - } - - }); - - // Инициализация Ladda - var laddaLoad = $('.ladda-button-old').ladda(); - - // Дефолтные настройки аякс формы - var formOptions = { - dataType: 'json', - beforeSubmit: processStart, - success: processDone - }; - - // Табы настроек - $('#settings').easyResponsiveTabs(); - - // Дефолтные настройки magnificpopup - $.extend(true, $.magnificPopup.defaults, { - tClose: 'Закрыть (Esc)', // Alt text on close button - tLoading: 'Загрузка...', // Text that is displayed during loading. Can contain %curr% and %total% keys - ajax: { - tError: 'Контент не загружен.' // Error message when ajax request failed - } - }); - - // - $('#settingsForm').ajaxForm(formOptions); - - $('.mfp-open').magnificPopup(); - - $('.mfp-open-ajax').magnificPopup({ - type: 'ajax' - }); - - $('.mfp-open-modal-map').magnificPopup({ - type: 'inline', - preloader: false, - // focus: '#username', - modal: true, - callbacks: { - open: function () { - doc.trigger('mapInit'); - }, - afterClose: function () { - doc.trigger('mapDestroy'); - } - } - }); - - /** - * [processStart description] - * @return {[type]} [description] - */ - function processStart() { - laddaLoad.ladda('start') - } - - /** - * [processDone description] - * @param {[type]} data [description] - * @return {[type]} [description] - */ - function processDone(data) { - var progress = 0; - var interval = setInterval(function () { - progress = Math.min(progress + Math.random() * 0.2, 1); - laddaLoad.ladda('setProgress', progress); - - if (progress === 1) { - laddaLoad.ladda('stop'); - clearInterval(interval); - } - }, 100); - } -}); - -function showSelectedPoint(obj) { - var $this = obj, - selectedData = $this.find('option:selected').data(), - $marker = $('.selected-marker'), - $iconLayout = $('.iconLayout'), - $iconImageSize0 = $('.iconImageSize0'), - $iconImageSize1 = $('.iconImageSize1'), - $iconImageOffset0 = $('.iconImageOffset0'), - $iconImageOffset1 = $('.iconImageOffset1'); - - $marker.prop('src', selectedData.selectImg); - $('.set-icon-color-input').remove(); - $('.selected-marker').css('background', 'none'); - - if (selectedData.iconColor) { - $marker.css('background', selectedData.iconColor); - $('.marker-select-wrapper').append(''); - } - - if (selectedData.sizeWidth > 0) { - $iconLayout.val('default#image'); - $iconImageSize0.val(selectedData.sizeWidth); - $iconImageSize1.val(selectedData.sizeHeight); - $iconImageOffset0.val((selectedData.offsetWidth !== '') ? selectedData.offsetWidth : '-' + Math.round(selectedData.sizeWidth / 2)); - $iconImageOffset1.val((selectedData.offsetHeight !== '') ? selectedData.offsetHeight : '-' + Math.round(selectedData.sizeHeight / 2)); - } else { - $iconLayout.val(''); - $iconImageSize0.val(''); - $iconImageSize1.val(''); - $iconImageOffset0.val(''); - $iconImageOffset1.val(''); - } -} diff --git a/upload/engine/modules/ymaps/js/ymaps_editnews.js b/upload/engine/modules/ymaps/js/ymaps_editnews.js deleted file mode 100644 index 73dea3b..0000000 --- a/upload/engine/modules/ymaps/js/ymaps_editnews.js +++ /dev/null @@ -1,49 +0,0 @@ -/**! - * DLE-YandexMaps — Бесплатный модуль Яндекс Карт для DLE - * - * @author ПафНутиЙ - * @link https://git.io/v9irg - */ - -var doc = $(document); - -doc - .on('click', '.popup-modal-dismiss', function (e) { - e.preventDefault(); - $.magnificPopup.close(); - }) - .on('click', '.btn-editmap-save', function (e) { - if (coordsFieldText) { - pointInput.val(coordsFieldText); - hideCoordsField(); - } - - }); -jQuery(document).ready(function ($) { - $.ajax({ - url: 'engine/ajax/ymaps/editnews.php' - }) - .done(function (data) { - $('#addnews').append(data); - hideCoordsField(); - $.extend(true, $.magnificPopup.defaults, { - tClose: 'Закрыть (Esc)', - tLoading: 'Загрузка...' - }); - - $('.btn-editmap-modal').magnificPopup({ - type: 'inline', - preloader: false, - modal: true, - callbacks: { - open: function () { - doc.trigger('editMapInit'); - } - } - }); - - }) - .fail(function () { - console.log("error"); - }); -}); diff --git a/upload/engine/modules/ymaps/language/English.lng b/upload/engine/modules/ymaps/language/English.lng deleted file mode 100644 index 8832c08..0000000 --- a/upload/engine/modules/ymaps/language/English.lng +++ /dev/null @@ -1,135 +0,0 @@ - 'English', - 'moduleLangName' => 'Language', - 'moduleSettings' => 'Settings', - 'allmapsSettings' => 'Customize the page with labels', - 'mapsHelp' => 'Help (Rus)', - 'mapsSupport' => 'Help and support', - 'moduleOn' => 'To enable the module', - 'moduleTextManagment' => 'Management module', - 'moduleTextAllSections' => 'A list of all partitions', - 'moduleTextCheckUpdates' => 'Check for updates', - 'moduleTextUnderConstructionFunction' => 'This function is still in development. Stay tuned in twitter.', - - 'mapSettings' => 'Map settings', - 'mapsSettings' => 'Customize the page with labels', - - 'moduleTextApiKey' => 'API Key Yandex maps', - 'moduleTextApiKeyWhat' => 'For what need key?', - 'moduleTextMapHeight' => 'The height of the default map (px)', - 'moduleTextMapControls' => 'The map controls', - 'moduleTextMapFullScreen' => 'click the expander card in full screen', - 'moduleTextMapLocation' => 'button location', - 'moduleTextMapRoute' => 'button to enable and disable the behavior editor "route"', - 'moduleTextMapRuler' => 'button to enable and disable the behavior of the "ruler"', - 'moduleTextMapSearchPanel' => 'search bar', - 'moduleTextMapProbki' => 'the panel tubes', - 'moduleTextMapTypeTrigger' => 'panel to switch the card type', - 'moduleTextMapZoom' => 'the zoom slider', - 'moduleTextMapZoomDefault' => 'The center of the map and zoom of default', - 'moduleTextMapLat' => 'Latitude', - 'moduleTextMapLon' => 'Longitude', - 'moduleTextMapZoomPlaceholder' => 'Zoom', - 'moduleTextMapSelectOnMap' => 'select on map', - 'moduleTextMapZoomXf' => 'The xfield name for information about the point', - 'moduleTextMapZoomXfPlaceholder' => 'Coordinates and zoom the map', - 'moduleTextMapZoomXfPlaceholderText' => 'For example coords', - 'moduleTextMapBaloonXf' => 'The xfield name for the content of a balun', - 'moduleTextMapBaloonXfPlaceholder' => 'The contents of a balun card', - 'moduleTextMapBaloonXfPlaceholderText'=> 'For example balloon', - - 'moduleTextEnterPlacemarkText' => 'Enter a description tag', - - - - 'moduleTextMissedTemplateFile' => 'No template file', - 'moduleActionYes' => 'Yes', - 'moduleActionNo' => 'No', - 'moduleActionClose' => 'Close', - 'moduleActionSave' => 'Save', - 'moduleActionCancel' => 'Cancel', - 'moduleActionCreateXf' => 'Create', - 'updateAviable' => 'Update available', - 'ot' => 'from', - 'update' => 'Update', - 'noUpdate' => 'There is no update.', - 'field' => 'Field', - 'successfullyСreated' => 'successfully created!', - 'xfieldsSetup' => 'xfields management', - 'contactsForSupport' => 'Contact information and technical support:', - 'pafnutyName' => 'ПафНутиЙ', - 'pafnutySite' => 'The author\'s website', - 'pafnutyMail' => 'email of the author', - 'pafnutyGPlus' => '+Павел', - - // 1.4 - 'mapsPointSettings' => 'Setting labels', - 'pointersCat' => 'Marks in the categories: ', - 'pointersCatDefault' => 'Default icon: ', - 'catIdWrong' => 'The category does not exist', - 'moduleActionApply' => 'Apply', - 'markerCustomColor' => ' (its color)', - 'moduleActionChange' => 'Change', - 'moduleActionAdd' => 'Add', - 'moduleTextMarkerSettingsHeader' => 'Setting labels for the category: ', - 'moduleTextMarkerWText' => 'Label with text', - 'moduleTextMarkerStrech' => 'Rubber label with text', - 'moduleTextMarkerWDot' => 'Label point', - 'moduleTextMarkerRound' => 'All tags', - 'moduleTextMarkerRoundWDot' => 'Round tag with point', - 'moduleTextMarkerCustom' => 'Own image', - 'moduleTextIconWidth' => 'The width of the icons: ', - 'moduleTextIconHeight' => 'The height of the icons: ', - 'moduleTextIconOffWidth' => 'Offset hoizontal: ', - 'moduleTextIconOffHeight' => 'The vertical offset: ', - 'moduleTextExampleLink' => 'An example of positioning the icons', - 'moduleTextEditPlacemark' => 'Edit tag', - 'moduleTextAddPlacemark' => 'Add tag', - 'moduleTextDelPlacemark' => 'Remove label', - 'moduleTextNoNews' => 'Nothing found', - 'moduleTextLicenceKey' => 'License key module', - 'moduleTextGetlicenceKey' => 'Get the key', - 'moduleTextHelp' => 'Help module', - 'moduleLongText1' => 'Help is on the official support site for address', - 'moduleLongText2' => 'Support module is only for customers support.', - 'moduleLongText3' => 'To get the status of the client support needs', - 'moduleTextBreef' => 'fill form', - 'moduleLongText4' => 'In the comments, be sure to specify the date of purchase and information about the payment module.', - 'moduleLongText5' => 'If You already iavleaetesi customer (bought a template or other modules) — tell me about it, will solve any issues.', - 'moduleTextSupportСond' => 'Technical support', - 'moduleTextOtherSite' => 'Use the module on a few of their own sites', - 'moduleLongText6' => '', - - - 'status_1' => 'Active', - 'status_2' => 'Attention, the license validity period has ended.', - 'status_3' => 'Attention, the license is reissued. Waiting for re-activation.', - 'status_4' => 'Error, the license was suspended.', - 'localhost' => 'Active on localhost, the local computer, the real server will be activated.', - 'pending' => 'Error, license pending.', - 'download_access_expired' => 'Error, the activation key is not suitable for the installed version. Please put an older version of the product.', - 'missing_license_key' => 'Error, the license key is not specified.', - 'could_not_obtain_local_key' => 'Error, it is impossible to obtain a new local key.', - 'maximum_delay_period_expired' => 'Error, the grace period local key has expired.', - 'local_key_tampering' => 'Error, the local license key is corrupted or not valid.', - 'local_key_invalid_for_location' => 'Error, the local key is not suited to this site.', - 'missing_license_file' => 'Error, create the following empty file and folders if they are gone:
    ', - 'license_file_not_writable' => 'Error, make to record the following ways:
    ', - 'invalid_local_key_storage' => 'Error, it is not possible to delete the old local key.', - 'could_not_save_local_key' => 'Error, it is not possible to record a new local key.', - 'license_key_string_mismatch' => 'Error, the local key is not valid for the specified license.', - 'license_error' => 'License error, contact the author of the module.', - 'licenseStatus' => 'License status: ', - 'moduleActionReset' => 'Reset', - - // 1.4.3 - 'moduleActionDelete' => 'Delete', - - // 1.4.4 - 'moduleLongText7' => '', - 'moduleTextDocks' => 'Documentation and examples of usage', -); - -?> \ No newline at end of file diff --git a/upload/engine/modules/ymaps/language/Russian.lng b/upload/engine/modules/ymaps/language/Russian.lng deleted file mode 100644 index 03cb99b..0000000 --- a/upload/engine/modules/ymaps/language/Russian.lng +++ /dev/null @@ -1,135 +0,0 @@ - 'Russian', - 'moduleLangName' => 'Язык', - 'moduleSettings' => 'Настройки', - 'allmapsSettings' => 'Настройки страницы с метками', - 'mapsHelp' => 'Справка (Rus)', - 'mapsSupport' => 'Справка и техподдержка', - 'moduleOn' => 'Включить модуль', - 'moduleTextManagment' => 'Управление модулем', - 'moduleTextAllSections' => 'Список всех разделов', - 'moduleTextCheckUpdates' => 'Проверить обновления', - 'moduleTextUnderConstructionFunction' => 'Данный функционал пока в разработке. Следите за обновлениями в twitter.', - - 'mapSettings' => 'Настройки карты', - 'mapsSettings' => 'Настройки страницы с метками', - - 'moduleTextApiKey' => 'API Key Яндекс карт', - 'moduleTextApiKeyWhat' => 'Для чего нужен ключ?', - 'moduleTextMapHeight' => 'Высота карты по умолчанию (px)', - 'moduleTextMapControls' => 'Элементы управления картой', - 'moduleTextMapFullScreen' => 'кнопка разворачивания карты на весь экран', - 'moduleTextMapLocation' => 'кнопка определения местоположения пользователя', - 'moduleTextMapRoute' => 'кнопка включения и отключения поведения "редактор маршрута"', - 'moduleTextMapRuler' => 'кнопка включения и отключения поведения "линейка"', - 'moduleTextMapSearchPanel' => 'панель поиска', - 'moduleTextMapProbki' => 'панель пробок', - 'moduleTextMapTypeTrigger' => 'панель переключения типа карты', - 'moduleTextMapZoom' => 'ползунок масштаба', - 'moduleTextMapZoomDefault' => 'Центр карты и зум по умолчанию', - 'moduleTextMapLat' => 'Широта', - 'moduleTextMapLon' => 'Долгота', - 'moduleTextMapZoomPlaceholder' => 'Зум', - 'moduleTextMapSelectOnMap' => 'выбрать на карте', - 'moduleTextMapZoomXf' => 'Имя допполя для информации о точке', - 'moduleTextMapZoomXfPlaceholder' => 'Координаты и зум карты', - 'moduleTextMapZoomXfPlaceholderText' => 'Например coords', - 'moduleTextMapBaloonXf' => 'Имя допполя для содержимого балуна', - 'moduleTextMapBaloonXfPlaceholder' => 'Содержимое балуна карты', - 'moduleTextMapBaloonXfPlaceholderText'=> 'Например balloon', - - 'moduleTextEnterPlacemarkText' => 'Введите описание метки', - - - - 'moduleTextMissedTemplateFile' => 'Отсутствует файл шаблона', - 'moduleActionYes' => 'Да', - 'moduleActionNo' => 'Нет', - 'moduleActionClose' => 'Закрыть', - 'moduleActionSave' => 'Сoхранить', - 'moduleActionCancel' => 'Отменить', - 'moduleActionCreateXf' => 'Создать поле', - 'updateAviable' => 'Доступно обновление', - 'ot' => 'от', - 'update' => 'Обновить', - 'noUpdate' => 'Обновлений нет.', - 'field' => 'Поле', - 'successfullyСreated' => 'успешно создано!', - 'xfieldsSetup' => 'управление допполями', - 'contactsForSupport' => 'Контакты для связи и техподдержки:', - 'pafnutyName' => 'ПафНутиЙ', - 'pafnutySite' => 'Сайт автора', - 'pafnutyMail' => 'email автора', - 'pafnutyGPlus' => '+Павел', - - // 1.4 - 'mapsPointSettings' => 'Настройка меток', - 'pointersCat' => 'Метки в категориях: ', - 'pointersCatDefault' => 'Иконка по умолчанию: ', - 'catIdWrong' => 'Категория не существует', - 'moduleActionApply' => 'Применить', - 'markerCustomColor' => ' (свой цвет)', - 'moduleActionChange' => 'Изменить', - 'moduleActionAdd' => 'Добавить', - 'moduleTextMarkerSettingsHeader' => 'Настройка метки для категории: ', - 'moduleTextMarkerWText' => 'Метки с текстом', - 'moduleTextMarkerStrech' => 'Резиновые метки с текстом', - 'moduleTextMarkerWDot' => 'Метки с точкой', - 'moduleTextMarkerRound' => 'Круглые метки', - 'moduleTextMarkerRoundWDot' => 'Круглые метки с точкой', - 'moduleTextMarkerCustom' => 'Собственное изображение', - 'moduleTextIconWidth' => 'Ширина иконки: ', - 'moduleTextIconHeight' => 'Высота иконки: ', - 'moduleTextIconOffWidth' => 'Смещение по гоизонтали: ', - 'moduleTextIconOffHeight' => 'Смещение по вертикали: ', - 'moduleTextExampleLink' => 'Пример позиционирования иконки', - 'moduleTextEditPlacemark' => 'Редактировать метку', - 'moduleTextAddPlacemark' => 'Добавить метку', - 'moduleTextDelPlacemark' => 'Удалить метку', - 'moduleTextNoNews' => 'Ничего не найдено', - 'moduleTextLicenceKey' => 'Лицензионный ключ модуля', - 'moduleTextGetlicenceKey' => 'Получить ключ', - 'moduleTextHelp' => 'Справка по модулю', - 'moduleLongText1' => 'Справка по модулю находится на официальном сайте поддержки по адресу', - 'moduleLongText2' => 'Техническая поддержка по модулю оказывается только клиентам техподдержки.', - 'moduleLongText3' => 'Для получения статуса клиента техподдержки, необходимо', - 'moduleTextBreef' => 'заполнить анкету', - 'moduleLongText4' => 'При этом в комментарии обязательно укажите дату покупки и информацию об оплате модуля.', - 'moduleLongText5' => 'Если Вы уже являеетесь клиентом (покупали шаблон или другие модули) — напомните мне об этом, решим любые вопросы.', - 'moduleTextSupportСond' => 'Техническая поддержка', - 'moduleTextOtherSite' => 'Использование модуля на нескольких собственных сайтах', - 'moduleLongText6' => '', - - - 'status_1' => 'Активна', - 'status_2' => 'Внимание, срок действия лицензии закончился.', - 'status_3' => 'Внимание, лицензия переиздана. Ожидает повторной активации.', - 'status_4' => 'Ошибка, лицензия была приостановлена.', - 'localhost' => 'Активна на localhost, используется локальный компьютер, на реальном сервере произойдет активация.', - 'pending' => 'Ошибка, лицензия ожидает рассмотрения.', - 'download_access_expired' => 'Ошибка, ключ активации не подходит для установленной версии. Пожалуйста поставьте более старую версию продукта.', - 'missing_license_key' => 'Ошибка, лицензионный ключ не указан.', - 'could_not_obtain_local_key' => 'Ошибка, невозможно получить новый локальный ключ.', - 'maximum_delay_period_expired' => 'Ошибка, льготный период локального ключа истек.', - 'local_key_tampering' => 'Ошибка, локальный лицензионный ключ поврежден или не действителен.', - 'local_key_invalid_for_location' => 'Ошибка, локальный ключ не подходит к данному сайту.', - 'missing_license_file' => 'Ошибка, создайте следующий пустой файл и папки если их нет:
    ', - 'license_file_not_writable' => 'Ошибка, сделайте доступными для записи следующие пути:
    ', - 'invalid_local_key_storage' => 'Ошибка, не возможно удалить старый локальный ключ.', - 'could_not_save_local_key' => 'Ошибка, не возможно записать новый локальный ключ.', - 'license_key_string_mismatch' => 'Ошибка, локальный ключ не действителен для указанной лицензии.', - 'license_error' => 'Ошибка лицензии, обратитесь к автору модуля.', - 'licenseStatus' => 'Статус лицензии: ', - 'moduleActionReset' => 'Сбросить', - - // 1.4.3 - 'moduleActionDelete' => 'Удалить', - - // 1.4.4 - 'moduleLongText7' => '', - 'moduleTextDocks' => 'Документация и примеры использования', -); - -?> \ No newline at end of file diff --git a/upload/engine/modules/ymaps/language/Ukrainian.lng b/upload/engine/modules/ymaps/language/Ukrainian.lng deleted file mode 100644 index 810b674..0000000 --- a/upload/engine/modules/ymaps/language/Ukrainian.lng +++ /dev/null @@ -1,135 +0,0 @@ - 'Ukrainian', - 'moduleLangName' => 'Мова', - 'moduleSettings' => 'Налаштування', - 'allmapsSettings' => 'Налаштування сторінки з наліпками', - 'mapsHelp' => 'Довідка (Rus)', - 'mapsSupport' => 'Довідка і техпідтримка', - 'moduleOn' => 'Включити модуль', - 'moduleTextManagment' => 'Керування модулем', - 'moduleTextAllSections' => 'Список всіх розділів', - 'moduleTextCheckUpdates' => 'Перевірити оновлення', - 'moduleTextUnderConstructionFunction' => 'Даний функціонал поки в розробці. Слідкуйте за оновленнями twitter.', - - 'mapSettings' => 'Налаштування карти', - 'mapsSettings' => 'Налаштування сторінки з мітками', - - 'moduleTextApiKey' => 'API Key Яндекс карт', - 'moduleTextApiKeyWhat' => 'Для чого потрібен ключ?', - 'moduleTextMapHeight' => 'Висота карти за замовчуванням (px)', - 'moduleTextMapControls' => 'Елементи управління картою', - 'moduleTextMapFullScreen' => 'кнопка розгортання карти на весь екран', - 'moduleTextMapLocation' => 'кнопка визначення місця розташування користувача', - 'moduleTextMapRoute' => 'кнопка включення і відключення поведінки "редактор маршруту"', - 'moduleTextMapRuler' => 'кнопка включення і відключення поведінки "лінійка"', - 'moduleTextMapSearchPanel' => 'панель пошуку', - 'moduleTextMapProbki' => 'панель пробок', - 'moduleTextMapTypeTrigger' => 'панель перемикання типу карти', - 'moduleTextMapZoom' => 'повзунок масштабу', - 'moduleTextMapZoomDefault' => 'Центр карти і зум за замовчуванням', - 'moduleTextMapLat' => 'Ширина', - 'moduleTextMapLon' => 'Довгота', - 'moduleTextMapZoomPlaceholder' => 'Зум', - 'moduleTextMapSelectOnMap' => 'вибрати на карті', - 'moduleTextMapZoomXf' => 'Ім\'я допполя для інформації про точку', - 'moduleTextMapZoomXfPlaceholder' => 'Координати і зум карти', - 'moduleTextMapZoomXfPlaceholderText' => 'Наприклад coords', - 'moduleTextMapBaloonXf' => 'Ім\'я допполя вмісту балуна', - 'moduleTextMapBaloonXfPlaceholder' => 'Вміст балуна карти', - 'moduleTextMapBaloonXfPlaceholderText'=> 'Наприклад balloon', - - 'moduleTextEnterPlacemarkText' => 'Введіть опис мітки', - - - - 'moduleTextMissedTemplateFile' => 'Відсутній файл шаблону', - 'moduleActionYes' => 'Так', - 'moduleActionNo' => 'Немає', - 'moduleActionClose' => 'Закрити', - 'moduleActionSave' => 'Зберегти', - 'moduleActionCancel' => 'Скасувати', - 'moduleActionCreateXf' => 'Створити поле', - 'updateAviable' => 'Оновлення', - 'ot' => 'від', - 'update' => 'Оновити', - 'noUpdate' => 'Оновлень немає.', - 'field' => 'Поле', - 'successfullyСreated' => 'успішно створений!', - 'xfieldsSetup' => 'управління допполями', - 'contactsForSupport' => 'Контакти для зв\'язку і техпідтримки:', - 'pafnutyName' => 'ПафНутиЙ', - 'pafnutySite' => 'Сайт автора', - 'pafnutyMail' => 'email автора', - 'pafnutyGPlus' => '+Павел', - - // 1.4 - 'mapsPointSettings' => 'Налаштування міток', - 'pointersCat' => 'Мітки в категоріях: ', - 'pointersCatDefault' => 'Іконка за замовчуванням: ', - 'catIdWrong' => 'Категорія не існує', - 'moduleActionApply' => 'Застосувати', - 'markerCustomColor' => ' (свій колір)', - 'moduleActionChange' => 'Змінити', - 'moduleActionAdd' => 'Додати', - 'moduleTextMarkerSettingsHeader' => 'Налаштування мітки для категорії: ', - 'moduleTextMarkerWText' => 'Мітки з текстом', - 'moduleTextMarkerStrech' => 'Гумові мітки з текстом', - 'moduleTextMarkerWDot' => 'Мітки з точкою', - 'moduleTextMarkerRound' => 'Круглі мітки', - 'moduleTextMarkerRoundWDot' => 'Круглі мітки з точкою', - 'moduleTextMarkerCustom' => 'Власне зображення', - 'moduleTextIconWidth' => 'Ширина іконки: ', - 'moduleTextIconHeight' => 'Висота іконки: ', - 'moduleTextIconOffWidth' => 'Зсув по гоизонтали: ', - 'moduleTextIconOffHeight' => 'Зсув по вертикалі: ', - 'moduleTextExampleLink' => 'Приклад позиціонування іконки', - 'moduleTextEditPlacemark' => 'Редагувати мітку', - 'moduleTextAddPlacemark' => 'Додати мітку', - 'moduleTextDelPlacemark' => 'Видалити мітку', - 'moduleTextNoNews' => 'Нічого не знайдено', - 'moduleTextLicenceKey' => 'Ліцензійний ключ модуля', - 'moduleTextGetlicenceKey' => 'Отримати ключ', - 'moduleTextHelp' => 'Справка по модулю', - 'moduleLongText1' => 'Довідка по модулю знаходиться на офіційному сайті підтримки за адресою', - 'moduleLongText2' => 'Технічна підтримка по модулю виявляється тільки клієнтам техпідтримки.', - 'moduleLongText3' => 'Для отримання статусу клієнта техпідтримки, необхідно', - 'moduleTextBreef' => 'заповнити анкету', - 'moduleLongText4' => 'При цьому в коментарі обов\'язково вкажіть дату купівлі та інформацію про оплату модуля.', - 'moduleLongText5' => 'Якщо Ви вже являеетесь клієнтом (купували шаблон або інші модулі) — нагадайте мені про це, вирішимо будь-які питання.', - 'moduleTextSupportСond' => 'Технічна підтримка', - 'moduleTextOtherSite' => 'Використання модуля на декількох власних сайтах', - 'moduleLongText6' => '', - - - 'status_1' => 'Активна', - 'status_2' => 'Увагу, термін дії ліцензії закінчився.', - 'status_3' => 'Увагу, ліцензія перевидана. Очікує повторної активації.', - 'status_4' => 'Помилка, ліцензія була припинена.', - 'localhost' => 'Активна на localhost, використовується локальний комп\'ютер, на реальному сервері відбудеться активація.', - 'pending' => 'Помилка, ліцензія очікує розгляду.', - 'download_access_expired' => 'Помилка, ключ активації не підходить для встановленої версії. Будь ласка поставте більш стару версію продукту.', - 'missing_license_key' => 'Помилка, ліцензійний ключ не вказано.', - 'could_not_obtain_local_key' => 'Помилка, неможливо отримати новий локальний ключ.', - 'maximum_delay_period_expired' => 'Помилка, пільговий період локального ключа закінчився.', - 'local_key_tampering' => 'Помилка, локальний ліцензійний ключ пошкоджений або не дійсний.', - 'local_key_invalid_for_location' => 'Помилка, локальний ключ не підходить до даного сайту.', - 'missing_license_file' => 'Помилка, створіть пустий файл і папки якщо їх немає:
    ', - 'license_file_not_writable' => 'Помилка, зробіть для запису наступні шляхи:
    ', - 'invalid_local_key_storage' => 'Помилка, не можливо видалити старий локальний ключ.', - 'could_not_save_local_key' => 'Помилка, не можливо записати новий локальний ключ.', - 'license_key_string_mismatch' => 'Помилка, локальний ключ не дійсний для зазначеної ліцензії.', - 'license_error' => 'Помилка ліцензії, зверніться до автора модуля.', - 'licenseStatus' => 'Статус ліцензії: ', - 'moduleActionReset' => 'Сбросить', - - // 1.4.3 - 'moduleActionDelete' => 'Видалити', - - // 1.4.4 - 'moduleLongText7' => '', - 'moduleTextDocks' => 'Документація та приклади використання', -); - -?> \ No newline at end of file diff --git a/upload/engine/plugins/loader/loader.php b/upload/engine/plugins/loader/loader.php deleted file mode 100644 index 5c25a9d..0000000 --- a/upload/engine/plugins/loader/loader.php +++ /dev/null @@ -1,13 +0,0 @@ - - - - -Error!!! - -Error!!! - diff --git a/upload/templates/Default/ymaps/default.tpl b/upload/templates/Default/ymaps/default.tpl deleted file mode 100644 index e28aa79..0000000 --- a/upload/templates/Default/ymaps/default.tpl +++ /dev/null @@ -1,51 +0,0 @@ -{scripts} - -Показать карту - -

    - -
    \ No newline at end of file diff --git a/upload/templates/Default/ymaps/icons/.htaccess b/upload/templates/Default/ymaps/icons/.htaccess deleted file mode 100644 index d1163bf..0000000 --- a/upload/templates/Default/ymaps/icons/.htaccess +++ /dev/null @@ -1,2 +0,0 @@ -Order Deny,Allow -Allow from all diff --git a/upload/templates/Default/ymaps/icons/index.htm b/upload/templates/Default/ymaps/icons/index.htm deleted file mode 100644 index 7d13843..0000000 --- a/upload/templates/Default/ymaps/icons/index.htm +++ /dev/null @@ -1,8 +0,0 @@ - - - - -Error!!! - -Error!!! - diff --git a/upload/templates/Default/ymaps/index.htm b/upload/templates/Default/ymaps/index.htm deleted file mode 100644 index 7d13843..0000000 --- a/upload/templates/Default/ymaps/index.htm +++ /dev/null @@ -1,8 +0,0 @@ - - - - -Error!!! - -Error!!! - diff --git a/upload/templates/Default/ymaps/ymaps.js b/upload/templates/Default/ymaps/ymaps.js deleted file mode 100644 index 3f5191b..0000000 --- a/upload/templates/Default/ymaps/ymaps.js +++ /dev/null @@ -1,180 +0,0 @@ -/**! - * DLE-YandexMaps — Бесплатный модуль Яндекс Карт для DLE - * - * @author ПафНутиЙ - * @link https://git.io/v9irg - */ - -var doc = $(document); - -doc - .on('change', '#category', function() { - hideCoordsField('.btn-addmap'); - }) - .on('click', '.add-map-save', function() { - applyCoords(); - }) - .on('click', '.add-map-clear', function() { - resetCoords(); - }); - - // Инициализация карты. - - ymaps.ready(addMapInit); - - function addMapInit() { - var addnewsMap, - myPlacemark; - doc - .on('mapInit', function() { - var $map = $('#map'), - coors = getCorrsFromInput(), - lat = coors.lat, - lon = coors.lon, - zoom = coors.zoom; - - $map.height(height); - - if (addnewsMap) { - myPlacemark = false; - addnewsMap.events.remove(['click','boundschange','dragend']); - addnewsMap.destroy(); - }; - - addnewsMap = new ymaps.Map('map', { - center: [lat, lon], // Саратов - zoom: zoom, - controls: controls - }); - console.log('getInput', getInput()); - - if (getInput()) { - var _coords = $.parseJSON(getInput()); - myPlacemark = createPlacemark([_coords.lat*1, _coords.lon*1]); - addnewsMap.geoObjects.add(myPlacemark); - }; - - // Слушаем клик на карте - addnewsMap.events - .add('click', function (e) { - var coords = e.get('coords'); - // Если метка уже создана – просто передвигаем ее - if (myPlacemark) { - myPlacemark.geometry.setCoordinates(coords); - console.log('двигаем'); - } - // Если нет – создаем. - else { - console.log('создаём'); - myPlacemark = createPlacemark(coords); - addnewsMap.geoObjects.add(myPlacemark); - - // Слушаем событие окончания перетаскивания на метке. - myPlacemark.events.add('dragend', function () { - setCenter(myPlacemark.geometry.getCoordinates(), addnewsMap.getZoom()); - }); - } - setCenter(coords, addnewsMap.getZoom()); - }) - .add('boundschange', function (e) { - setCenter([lat*1, lon*1], addnewsMap.getZoom()); - }); - - // Создание метки - function createPlacemark(coords) { - // переменная arPlacemarkStyles определена в модуле - var categoryId = ($('#category').length) ? $('#category option:selected').val() : 0, - key = (categoryId > 0) ? categoryId : 'default', - placemarkStyle = $.parseJSON(arPlacemarkStyles); - - console.log('categoryId: ',categoryId); - return new ymaps.Placemark(coords, {}, - placemarkStyle[key] - ); - } - }); - }; - -jQuery(document).ready(function($) { - // Прячем поле с координатами. - // Сама функция живёт в /engine/modules/ymaps/addnews.php - // и генерируется автоматически в зависимости от поля. - hideCoordsField('.btn-addmap'); - if ($.magnificPopup) { - // Дефолтные настройки magnificpopup - $.extend(true, $.magnificPopup.defaults, { - tClose: 'Закрыть (Esc)', - tLoading: 'Загрузка...' - }); - - - $('[data-mfp-src]').magnificPopup({ - type: 'inline', - preloader: false, - // focus: '#username', - modal: true, - callbacks: { - open : function () { - doc.trigger('mapInit'); - } - } - }); - }; - - if ($('#map-inline').length) { - ymaps.ready(ymapInline); - function ymapInline() { - var addnewsMap, - myPlacemark, - $map = $('#map'), - coors = getCorrsFromInput(), - lat = coors.lat, - lon = coors.lon, - zoom = coors.zoom; - - $map.height(height); - - if (!addnewsMap) { - - addnewsMap = new ymaps.Map('map-inline', { - center: [lat, lon], // Саратов - zoom: zoom, - controls: controls - }); - }; - // Слушаем клик на карте - addnewsMap.events.add('click', function (e) { - var coords = e.get('coords'); - - // Если метка уже создана – просто передвигаем ее - if (myPlacemark) { - myPlacemark.geometry.setCoordinates(coords); - } - // Если нет – создаем. - else { - myPlacemark = createPlacemark(coords); - - addnewsMap.geoObjects.add(myPlacemark); - // Слушаем событие окончания перетаскивания на метке. - myPlacemark.events.add('dragend', function () { - setCenter(myPlacemark.geometry.getCoordinates(), addnewsMap.getZoom()); - }); - } - setCenter(coords, addnewsMap.getZoom()); - }) - .add('boundschange', function (e) { - setCenter([lat * 1, lon * 1], addnewsMap.getZoom()); - }); - - // Создание метки - function createPlacemark(coords) { - return new ymaps.Placemark(coords, { - draggable: true - }); - } - - - } - } - -}); //ready \ No newline at end of file diff --git a/upload/templates/Default/ymaps/ymaps_public.js b/upload/templates/Default/ymaps/ymaps_public.js deleted file mode 100644 index 7247afb..0000000 --- a/upload/templates/Default/ymaps/ymaps_public.js +++ /dev/null @@ -1,37 +0,0 @@ -/**! - * DLE-YandexMaps — Бесплатный модуль Яндекс Карт для DLE - * - * @author ПафНутиЙ - * @link https://git.io/v9irg - */ - -var doc = $(document); - -doc - .on('click', '.modal-close, .btn-close', function() { - $.magnificPopup.close(); - }); - -jQuery(document).ready(function($) { - - // Дефолтные настройки magnificpopup - $.extend(true, $.magnificPopup.defaults, { - tClose: 'Закрыть (Esc)', // Alt text on close button - tLoading: 'Загрузка...', // Text that is displayed during loading. Can contain %curr% and %total% keys - ajax: { - tError: 'Контент не загружен.' // Error message when ajax request failed - } - }); - - $('[data-mfp-src]').magnificPopup({ - type: 'inline', - preloader: true, - modal: true, - callbacks: { - open : function () { - doc.trigger('mapInit'); - } - } - }); - -}); //ready diff --git a/upload/templates/Default/ymaps/ymaps_quickedit.js b/upload/templates/Default/ymaps/ymaps_quickedit.js deleted file mode 100644 index be7f60b..0000000 --- a/upload/templates/Default/ymaps/ymaps_quickedit.js +++ /dev/null @@ -1,52 +0,0 @@ -/**! - * DLE-YandexMaps — Бесплатный модуль Яндекс Карт для DLE - * - * @author ПафНутиЙ - * @link https://git.io/v9irg - */ - -var doc = $(document); - -doc - .on('dialogopen', '#dlepopup-news-edit', function (event, ui) { - var $this = $(this); - setTimeout(function () { - $.ajax({ - url: dle_root + 'engine/ajax/ymaps/editnews.php', - }) - .done(function(data) { - $this.append(data); - hideCoordsField(); - $.extend(true, $.magnificPopup.defaults, { - tClose: 'Закрыть (Esc)', - tLoading: 'Загрузка...' - }); - - $('.btn-editmap-modal').magnificPopup({ - type: 'inline', - preloader: false, - modal: true, - callbacks: { - open : function () { - doc.trigger('editMapInit'); - } - } - }); - - }) - .fail(function() { - console.log("error"); - }); - - }, 500); - }) - .on('click', '.popup-modal-dismiss', function(e) { - e.preventDefault(); - $.magnificPopup.close(); - }) - .on('click', '.btn-editmap-save', function(e) { - if (coordsFieldText) { - pointInput.val(coordsFieldText); - hideCoordsField(); - }; - }); diff --git a/upload/ymaps_install.php b/upload/ymaps_install.php deleted file mode 100644 index a43e5b9..0000000 --- a/upload/ymaps_install.php +++ /dev/null @@ -1,324 +0,0 @@ - 'ymaps', - - // Название модуля - показывается как в установщике, так и в админке. - 'moduleTitle' => 'Yandex Maps', - - // Описание модуля, для установщика и админки. - 'moduleDescr' => 'Модуль Яндекс.Карты для DLE', - - // Версия модуля, для установщика - 'moduleVersion' => '2.0.1', - - // Дата выпуска модуля, для установщика - 'moduleDate' => '16.10.2018', - - // Версии DLE, поддержваемые модулем, для установщика - 'dleVersion' => '10.x', - - // ID групп, для которых доступно управление модулем в админке. - 'allowGroups' => '1', - - // Массив с запросами, которые будут выполняться при установке - 'queries' => array(), - - // Устанавливать админку (true/false). Включает показ кнопки установки и удаления админки. - 'installAdmin' => true, - - // Отображать шаги утановки модуля - 'steps' => true - -); - -// Определяем кодировку. -$fileCharset = chasetConflict($cfg); - -// Шаги установки модуля -$steps = << -

    Редактирование файлов

    -

    Предварительная правка файлов для установки модуля не требуется.

    -

    Инструкция по настройке модуля находится на странице с документацией: http://maps.pafnuty.name/documentation/#setup

    -
    -HTML; - - -function installer() { - global $config, $dle_api, $cfg, $steps, $fileCharset; - - $output = ''; - - $queries = (count($cfg['queries'])) ? true : false; - - if ($queries) { - foreach ($cfg['queries'] as $qq) { - $queriesTxt .= ''; - } - } - - if ($cfg['installAdmin']) { - $aq = $dle_api->db->super_query("SELECT name FROM " . PREFIX . "_admin_sections WHERE name = '{$cfg['moduleName']}'"); - - $adminInstalled = ($aq['name'] == $cfg['moduleName']) ? true : false; - - } - - // Если через $_POST передаётся параметр install, производим инсталляцию, согласно параметрам - if (!empty($_POST['install'])) { - // Выводим результаты установки модуля - $output .= '
      '; - - if ($queries) { - // Выполняем запросы из массива. - foreach ($cfg['queries'] as $q) { - $query[] = $dle_api->db->query($q); - } - - $output .= '
    • Запросы выполнены!
    • '; - } - - // Установка админки (http://dle-news.ru/extras/online/include_admin.html) - if ($cfg['installAdmin']) { - - $install_admin = $dle_api->install_admin_module($cfg['moduleName'], $cfg['moduleTitle'], $cfg['moduleDescr'], $cfg['moduleName'] . '.png', $cfg['allowGroups']); - - if ($install_admin) { - $output .= '
    • Админчасть модуля установлена
    • '; - } - } - - $output .= '
    • Установка завершена!
    '; - $output .= '
    Не забудьте удалить файл установщика!
    '; - if ($cfg['installAdmin'] && $install_admin) { - $output .= '

    Настройка модуля


    '; - } - - } - - // Если через $_POST передаётся параметр remove, производим удаление админчасти модуля - elseif (!empty($_POST['remove'])) { - $remove_admin = $dle_api->uninstall_admin_module($cfg['moduleName']); - $output .= '

    Админчасть модуля удалена

    '; - $output .= '
    Не забудьте удалить файл установщика!
    '; - } - - // Если через $_POST ничего не передаётся, выводим форму для установки модуля - else { - // Выводим кнопку удаления модуля - if ($cfg['installAdmin'] && $adminInstalled) { - $uninstallForm = << -
    -
    Удаление админчасти модуля
    -
    -
    - - -
    -
    -
    -HTML; - } - // Выводим кнопку установки модуля с допзпросами - if ($queries) { - $installForm = << -
    Установка модуля
    -
    -
    - - - Какие запросы будут выполнены? -
    -
    - -
    - $queriesTxt -
    -HTML; - } - // Выводим кнопку установки админчасти модуля - else { - if (!$adminInstalled) { - $installForm = << -
    Установка админчасти
    -
    -
    - - -
    -
    - -HTML; - } - } - - // Вывод - if ($cfg['steps']) { - $output .= $steps; - } - $output .= <<Перед установкой модуля обязательно сделайте бэкап БД!

    -
    -

    Выполнение запросов в БД

    - - $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']?> - - - - - -
    -

    v. от

    -
    -
    -
    - -

    Мастер установки модуля для DLE

    - - - -
    -
    - Контакты:
    - DLE-YandexMaps — Репозиторий модуля
    - Техподдержка -
    - - - - - - - -