2016-11-29 00:38:45 +05:00
< ? php
/**
* AVE . cms - Модуль Gmap
*
* @ package AVE . cms
* @ subpackage module_gmap
* @ filesource
*/
if ( ! defined ( 'BASE_DIR' )) exit ;
if ( defined ( 'ACP' ))
{
$modul [ 'ModuleName' ] = 'GMap' ;
$modul [ 'ModuleSysName' ] = 'gmap' ;
2017-10-08 18:51:47 +05:00
$modul [ 'ModuleVersion' ] = '1.1.3b' ;
2016-11-29 00:38:45 +05:00
$modul [ 'ModuleDescription' ] = 'Gmap<br/>Для того, чтобы осуществить просмотр карты, необходимо разместить системный тег <strong>[mod_gmap:XXX]</strong> в теле какого-либо документа' ;
2017-03-06 00:01:41 +05:00
$modul [ 'ModuleAutor' ] = 'OcPh | Project Manager Duncan | Upgrade module 2016-2017 Repellent' ;
$modul [ 'ModuleCopyright' ] = '© 2016-2017 AVE.cms Team' ;
2016-11-29 00:38:45 +05:00
$modul [ 'ModuleIsFunction' ] = 1 ;
$modul [ 'ModuleAdminEdit' ] = 1 ;
$modul [ 'ModuleFunction' ] = 'mod_gmap' ;
$modul [ 'ModuleTag' ] = '[mod_gmap:XXX]' ;
$modul [ 'ModuleTagLink' ] = null ;
$modul [ 'ModuleAveTag' ] = '#\\\[mod_gmap:([\\\d-]+)]#' ;
$modul [ 'ModulePHPTag' ] = " <?php mod_gmap('' $ 1''); ?> " ;
}
/**
* Функция вывода карты
*
* @ param string $gmap_id идентификатор карты
*/
function mod_gmap ( $gmap_id )
{
global $AVE_Template ;
require_once ( BASE_DIR . '/modules/gmap/class.gmap.php' );
$gmap = new Gmap ;
$tpl_dir = BASE_DIR . '/modules/gmap/templates/' ;
$lang_file = BASE_DIR . '/modules/gmap/lang/' . $_SESSION [ 'user_language' ] . '.txt' ;
$AVE_Template -> config_load ( $lang_file );
$gmap -> gmapShow ( $tpl_dir , $gmap_id );
}
//=======================================================
// Действия в админ-панели
//=======================================================
if ( defined ( 'ACP' ) && ! empty ( $_REQUEST [ 'moduleaction' ]))
{
require_once ( BASE_DIR . '/modules/gmap/class.gmap.php' );
$gmap = new Gmap ;
$tpl_dir = BASE_DIR . '/modules/gmap/templates/' ;
$lang_file = BASE_DIR . '/modules/gmap/lang/' . $_SESSION [ 'admin_language' ] . '.txt' ;
$AVE_Template -> config_load ( $lang_file , 'admin' );
switch ( $_REQUEST [ 'moduleaction' ])
{
case '1' : // Просмотр списка карт
$gmap -> gmapListShow ( $tpl_dir );
break ;
case 'show' : // Просмотр маркеров карты
2017-02-18 22:35:39 +05:00
$_SESSION [ 'use_editor' ] = get_settings ( 'use_editor' );
2016-11-29 00:38:45 +05:00
$gmap -> gmapMarkersShow ( $tpl_dir , intval ( $_REQUEST [ 'id' ]));
break ;
2017-02-18 22:35:39 +05:00
case 'showcategory' : // Просмотр категорий
$gmap -> gmapCategoryShow ( $tpl_dir );
break ;
case 'editmarker' : // Редактирование маркера
$gmap -> gmapMarkerEdit ( $tpl_dir , intval ( $_REQUEST [ 'id' ]));
break ;
case 'saveeditmarker' : // Сохранение отредактированного маркера
$gmap -> gmapMarkerEditSave ( intval ( $_REQUEST [ 'id' ]));
break ;
case 'addnewcategory' : // Добавление новой категории
$gmap -> gmapCategoryNewAdd ( intval ( $_REQUEST [ 'id' ]));
break ;
case 'gcatdel' : // Удаление категории
$gmap -> gmapCategoryDel ( intval ( $_REQUEST [ 'id' ]));
break ;
2016-11-29 00:38:45 +05:00
case 'addmarker' : // Добавление маркера
$gmap -> gmapMarkersAdd ( intval ( $_REQUEST [ 'id' ]));
break ;
case 'savemarker' : // Сохранение маркера
$gmap -> gmapMarkerSave ( intval ( $_REQUEST [ 'id' ]));
break ;
case 'getmarker' : // Получение описания маркера
$gmap -> gmapMarkersGet ( intval ( $_REQUEST [ 'id' ]));
break ;
case 'delmarker' : // Удаление маркера
$gmap -> gmapMarkersDel ( intval ( $_REQUEST [ 'id' ]));
break ;
case 'new' : // Создать новую карту
$gmap -> gmapNew ();
break ;
case 'delgmap' : // Удаление карты
$gmap -> gmapDelete ( intval ( $_REQUEST [ 'id' ]));
break ;
case 'editgmap' : // Редактирование карты
$gmap -> gmapEdit ( $tpl_dir , intval ( $_REQUEST [ 'id' ]));
break ;
}
}
2017-02-18 22:35:39 +05:00
// подключаем файловый менеджер проверяем , если файла нет - создаем, если есть ничего не делаем
2017-07-01 23:59:24 +05:00
$filename = BASE_DIR . '/lib/redactor/elfinder/php/connector_module_gmap.php' ;
2017-02-18 22:35:39 +05:00
if ( ! file_exists ( $filename )) {
$gmfmen = ' < ? php
2017-05-26 23:33:18 +05:00
error_reporting ( 0 );
define ( " BASE_DIR " , str_replace ( " \\ \" , " / " , dirname(dirname(dirname(dirname(dirname(__FILE__)))))));
include_once " ../../../../inc/init.php " ;
if ( ! check_permission ( " mediapool_finder " ))
{
header ( " Location:/index.php " );
exit ;
2017-02-18 22:35:39 +05:00
}
2017-05-26 23:33:18 +05:00
require " ./autoload.php " ;
elFinder :: $netDrivers [ " ftp " ] = " FTP " ;
2017-02-18 22:35:39 +05:00
function access ( $attr , $path , $data , $volume ) {
2017-05-26 23:33:18 +05:00
return strpos ( basename ( $path ), " . " ) === 0
2017-02-18 22:35:39 +05:00
? ! ( $attr == " read " || $attr == " write " )
2017-05-26 23:33:18 +05:00
: null ;
2017-02-18 22:35:39 +05:00
}
$opts = array (
" roots " => array (
array (
2017-05-26 23:33:18 +05:00
" driver " => " LocalFileSystem " ,
" path " => " ../../../../ " . UPLOAD_DIR ,
" URL " => " / " . UPLOAD_DIR . " / " ,
" uploadOrder " => array ( " deny " , " allow " ),
" acceptedName " => " validName " ,
" uploadAllow " => array ( " all " ),
" uploadDeny " => array ( " all " ),
2017-02-18 22:35:39 +05:00
" uploadOverwrite " => false ,
2017-05-26 23:33:18 +05:00
" uploadMaxSize " => " 256m " ,
" accessControl " => " access " ,
" attributes " => array (
2017-02-18 22:35:39 +05:00
array (
" pattern " => " /^ \ / \ ./ " ,
" read " => false ,
" write " => false ,
" hidden " => true ,
" locked " => true
),
2017-05-26 23:33:18 +05:00
array (
" pattern " => " /.tmb/ " ,
" read " => false ,
" write " => false ,
" hidden " => true ,
" locked " => false
),
array (
" pattern " => " / \ .php $ / " ,
" read " => false ,
" write " => false ,
" hidden " => true ,
" locked " => false
),
2017-02-18 22:35:39 +05:00
array (
2017-05-26 23:33:18 +05:00
" pattern " => " /.quarantine/ " ,
" read " => false ,
" write " => false ,
" hidden " => true ,
" locked " => false
),
array (
" pattern " => " / \ .htaccess $ / " ,
" write " => false ,
" locked " => false ,
" hidden " => true
)
)
2017-02-18 22:35:39 +05:00
)
)
);
2017-05-26 23:33:18 +05:00
$connector = new elFinderConnector ( new elFinder ( $opts ));
2017-02-18 22:35:39 +05:00
$connector -> run ();
?> ';
2017-07-01 23:59:24 +05:00
$gfo = fopen ( BASE_DIR . " /lib/redactor/elfinder/php/connector_module_gmap.php " , " w " );
2017-02-18 22:35:39 +05:00
flock ( $gfo , 2 );
fwrite ( $gfo , $gmfmen );
flock ( $gfo , 3 );
fclose ( $gfo );
2017-07-01 23:59:24 +05:00
chmod ( BASE_DIR . " /lib/redactor/elfinder/php/connector_module_gmap.php " , 0755 );
2017-02-18 22:35:39 +05:00
}
2016-11-29 00:38:45 +05:00
?>