|
|
@ -1,10 +1,10 @@ |
|
|
|
<?php |
|
|
|
<?php |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* AVE.cms - Модуль импорта |
|
|
|
* AVE.cms - Модуль Импорта |
|
|
|
* |
|
|
|
* |
|
|
|
* @package AVE.cms |
|
|
|
* @package AVE.cms |
|
|
|
* @subpackage module_Import |
|
|
|
* @subpackage module_import |
|
|
|
* @filesource |
|
|
|
* @filesource |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
@ -12,99 +12,83 @@ if(!defined('BASE_DIR')) exit; |
|
|
|
|
|
|
|
|
|
|
|
if (defined('ACP')) |
|
|
|
if (defined('ACP')) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$modul['ModuleName'] = "Модуль импорта"; |
|
|
|
$modul = |
|
|
|
$modul['ModuleSysName'] = "import"; |
|
|
|
[ |
|
|
|
$modul['ModuleVersion'] = "1.2.2"; |
|
|
|
'ModuleName' => "Импорт (Облегченная версия)", |
|
|
|
$modul['ModuleDescription'] = "Данный модуль предназначен для импорта документов в определенную рубрику"; |
|
|
|
'ModuleSysName' => "import", |
|
|
|
$modul['ModuleAutor'] = "Realter, val005, M@dD3n"; |
|
|
|
'ModuleVersion' => "2.0", |
|
|
|
$modul['ModuleCopyright'] = "© AVE.cms Team - " . date('Y'); |
|
|
|
'ModuleDescription' => "Осуществляет импорт документов из файлов различных типов", |
|
|
|
$modul['ModuleStatus'] = 1; |
|
|
|
'ModuleAutor' => "AVE.cms Team", |
|
|
|
$modul['ModuleIsFunction'] = 0; |
|
|
|
'ModuleCopyright' => "© AVE.cms Team 2016", |
|
|
|
$modul['ModuleTemplate'] = 0; |
|
|
|
'ModuleStatus' => 1, |
|
|
|
$modul['ModuleAdminEdit'] = 1; |
|
|
|
'ModuleIsFunction' => 0, |
|
|
|
$modul['ModuleFunction'] = null; |
|
|
|
'ModuleTemplate' => 0, |
|
|
|
$modul['ModuleTag'] = null; |
|
|
|
'ModuleAdminEdit' => 1, |
|
|
|
$modul['ModuleTagLink'] = null; |
|
|
|
'ModuleFunction' => 'import', |
|
|
|
$modul['ModuleAveTag'] = null; |
|
|
|
'ModuleTag' => null, |
|
|
|
$modul['ModulePHPTag'] = null; |
|
|
|
'ModuleTagLink' => null, |
|
|
|
|
|
|
|
'ModuleAveTag' => null, |
|
|
|
|
|
|
|
'ModulePHPTag' => null |
|
|
|
|
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Администрирование |
|
|
|
* Админка |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function module_import_autoupdate() |
|
|
|
if (defined('ACP') && (isset($_REQUEST['moduleaction']))) |
|
|
|
{ |
|
|
|
{ |
|
|
|
global $AVE_DB; |
|
|
|
// класс |
|
|
|
|
|
|
|
require_once(BASE_DIR . '/modules/import/class.import.php'); |
|
|
|
|
|
|
|
|
|
|
|
$sql=" |
|
|
|
$import = new ModuleImport; |
|
|
|
SELECT |
|
|
|
|
|
|
|
Id, |
|
|
|
|
|
|
|
import_default_file, |
|
|
|
|
|
|
|
import_last_update |
|
|
|
|
|
|
|
FROM " . PREFIX . "_module_import |
|
|
|
|
|
|
|
WHERE import_monitor_file != 0 |
|
|
|
|
|
|
|
"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$res = $AVE_DB->Query($sql); |
|
|
|
// папка с шаблонами |
|
|
|
$rows = array(); |
|
|
|
$import->tpl_dir = BASE_DIR . '/modules/import/templates/'; |
|
|
|
|
|
|
|
|
|
|
|
while ($row = $res->FetchAssocArray()) |
|
|
|
// ланги |
|
|
|
{ |
|
|
|
$AVE_Template->config_load(BASE_DIR . '/modules/import/lang/' . $_SESSION['admin_language'] . '.txt', 'admin'); |
|
|
|
$rows[] = $row; |
|
|
|
$AVE_Template->assign('config_vars', $AVE_Template->get_config_vars()); |
|
|
|
|
|
|
|
|
|
|
|
if(file_exists(BASE_DIR . $row["import_default_file"])) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if(filemtime(BASE_DIR . $row["import_default_file"]) > $row['import_last_update']) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!(is_file(BASE_DIR . '/modules/import/class.import.php') && |
|
|
|
|
|
|
|
include_once(BASE_DIR . '/modules/import/class.import.php'))) module_error(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$import = new import; |
|
|
|
|
|
|
|
$import -> DoImport($row['Id']); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (defined('ACP') && $_REQUEST['moduleaction']) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (! (is_file(BASE_DIR . '/modules/import/class.import.php'))) |
|
|
|
|
|
|
|
module_error(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
include_once(BASE_DIR . '/modules/import/class.import.php'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$import = new import; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$tpl_dir = BASE_DIR . '/modules/import/templates/'; |
|
|
|
$header_list = 'Location:index.php?do=modules&action=modedit&mod=import&moduleaction=1&cp=' . SESSION . '&page=' . $_REQUEST['page']; |
|
|
|
$lang_file = BASE_DIR . '/modules/import/lang/' . $_SESSION['user_language'] . '.txt'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$AVE_Template->config_load($lang_file); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch($_REQUEST['moduleaction']) |
|
|
|
switch($_REQUEST['moduleaction']) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case '1': |
|
|
|
case '1': |
|
|
|
$import->importList($tpl_dir); |
|
|
|
$import->importsList(); |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'del': |
|
|
|
|
|
|
|
$import->importDelete($_REQUEST['id']); |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case 'edit': |
|
|
|
case 'edit': |
|
|
|
$import->importEdit(isset($_REQUEST['id']) ? $_REQUEST['id'] : null, $tpl_dir); |
|
|
|
$import->importEdit((int)$_REQUEST['import_id']); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case 'saveedit': |
|
|
|
case 'copy': |
|
|
|
$import->importSave(isset($_REQUEST['id']) ? $_REQUEST['id'] : null); |
|
|
|
$import_id = $import->importCopy((int)$_REQUEST['import_id']); |
|
|
|
break; |
|
|
|
header('Location:index.php?do=modules&action=modedit&mod=import&moduleaction=edit&import_id=' . $import_id . '&cp=' . SESSION); |
|
|
|
|
|
|
|
exit; |
|
|
|
|
|
|
|
|
|
|
|
case 'do': |
|
|
|
case 'save': |
|
|
|
$import->DoImport($_REQUEST['id'], false); |
|
|
|
$import_id = $import->importSave((int)$_REQUEST['import_id']); |
|
|
|
break; |
|
|
|
if (! $_REQUEST['import_id']) |
|
|
|
|
|
|
|
header('Location:index.php?do=modules&action=modedit&mod=import&moduleaction=edit&import_id=' . $import_id . '&cp=' . SESSION); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
header($header_list); |
|
|
|
|
|
|
|
exit; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'delete': |
|
|
|
|
|
|
|
$import->importDelete((int)$_REQUEST['import_id']); |
|
|
|
|
|
|
|
header($header_list); |
|
|
|
|
|
|
|
exit; |
|
|
|
|
|
|
|
|
|
|
|
case 'tags': |
|
|
|
case 'tags': |
|
|
|
$import->DoImport(isset($_REQUEST['id']) ? $_REQUEST['id'] : null, true); |
|
|
|
$import_id = (int)$_REQUEST['import_id']; |
|
|
|
break; |
|
|
|
$import->importRun($import_id, true); |
|
|
|
|
|
|
|
header('Location:index.php?do=modules&action=modedit&mod=import&moduleaction=edit&import_id=' . $import_id . '&cp=' . SESSION); |
|
|
|
|
|
|
|
exit; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'run': |
|
|
|
|
|
|
|
$import_id = (int)$_REQUEST['import_id']; |
|
|
|
|
|
|
|
$import->importRun($import_id); |
|
|
|
|
|
|
|
header('Location:index.php?do=modules&action=modedit&mod=import&moduleaction=edit&import_id=' . $import_id . '&cp=' . SESSION); |
|
|
|
|
|
|
|
exit; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
?> |
|
|
|
|