2013-05-02 10:11:03 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Initialize extensions
|
|
|
|
*
|
|
|
|
* @category DMS
|
|
|
|
* @package SeedDMS
|
|
|
|
* @license GPL 2
|
|
|
|
* @version @version@
|
|
|
|
* @author Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx>
|
|
|
|
* @copyright Copyright (C) 2013 Uwe Steinmann
|
|
|
|
* @version Release: @package_version@
|
|
|
|
*/
|
|
|
|
|
2021-02-04 09:50:38 +00:00
|
|
|
global $logger;
|
|
|
|
|
2013-05-02 10:11:03 +00:00
|
|
|
require "inc.ClassExtensionMgr.php";
|
|
|
|
require_once "inc.ClassExtBase.php";
|
|
|
|
|
2020-03-02 08:16:03 +00:00
|
|
|
$extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir, $settings->_repositoryUrl, $settings->_proxyUrl, $settings->_proxyUser, $settings->_proxyPassword);
|
2013-05-02 10:11:03 +00:00
|
|
|
|
2016-04-28 10:04:09 +00:00
|
|
|
$version = new SeedDMS_Version;
|
|
|
|
|
2020-01-03 09:21:58 +00:00
|
|
|
foreach($extMgr->getExtensionConfiguration() as $extname=>$extconf) {
|
2019-12-20 16:20:15 +00:00
|
|
|
if(!$settings->extensionIsDisabled($extname)) {
|
2020-01-03 09:21:58 +00:00
|
|
|
$disabled = true;
|
2021-11-04 16:06:47 +00:00
|
|
|
if($extMgr->checkExtensionByName($extname, $extconf)) {
|
2020-01-03 09:21:58 +00:00
|
|
|
$disabled = false;
|
|
|
|
} else {
|
2021-11-04 16:06:47 +00:00
|
|
|
$settings->disableExtension($extname);
|
2020-01-03 09:21:58 +00:00
|
|
|
// echo $extMgr->getErrorMsg();
|
|
|
|
}
|
2016-04-28 10:04:09 +00:00
|
|
|
/* check for requirements */
|
2020-01-03 09:21:58 +00:00
|
|
|
/*
|
2016-04-28 10:04:09 +00:00
|
|
|
if(!empty($extconf['constraints']['depends']['seeddms'])) {
|
|
|
|
$t = explode('-', $extconf['constraints']['depends']['seeddms'], 2);
|
2018-03-13 13:38:49 +00:00
|
|
|
if(SeedDMS_Extension_Mgr::cmpVersion($t[0], $version->version()) > 0 || ($t[1] && SeedDMS_Extension_Mgr::cmpVersion($t[1], $version->version()) < 0))
|
2020-01-03 09:21:58 +00:00
|
|
|
$disabled = true;
|
|
|
|
else
|
|
|
|
$disabled = false;
|
2016-04-28 10:04:09 +00:00
|
|
|
}
|
2020-01-03 09:21:58 +00:00
|
|
|
*/
|
|
|
|
if(!$disabled) {
|
2021-11-04 16:06:47 +00:00
|
|
|
if(isset($extconf['class']) && isset($extconf['class']['file']) && isset($extconf['class']['name'])) {
|
|
|
|
$classfile = $settings->_rootDir."/ext/".$extname."/".$extconf['class']['file'];
|
|
|
|
if(file_exists($classfile)) {
|
|
|
|
include($classfile);
|
|
|
|
$obj = new $extconf['class']['name']($settings, null, $logger);
|
|
|
|
if(method_exists($obj, 'init'))
|
2022-10-20 12:43:58 +00:00
|
|
|
$obj->init($extMgr);
|
2021-11-04 16:06:47 +00:00
|
|
|
}
|
2019-08-08 07:12:41 +00:00
|
|
|
}
|
2021-11-04 16:06:47 +00:00
|
|
|
if(isset($extconf['language']['file'])) {
|
|
|
|
$langfile = $settings->_rootDir."/ext/".$extname."/".$extconf['language']['file'];
|
|
|
|
if(file_exists($langfile)) {
|
|
|
|
unset($__lang);
|
|
|
|
include($langfile);
|
|
|
|
if(isset($__lang) && $__lang) {
|
|
|
|
foreach($__lang as $lang=>&$data) {
|
|
|
|
if(isset($GLOBALS['LANG'][$lang]))
|
|
|
|
$GLOBALS['LANG'][$lang] = array_merge($GLOBALS['LANG'][$lang], $data);
|
|
|
|
else
|
|
|
|
$GLOBALS['LANG'][$lang] = $data;
|
|
|
|
}
|
2013-08-15 18:37:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-05-02 10:11:03 +00:00
|
|
|
}
|
|
|
|
}
|