Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2025-09-06 13:41:58 +02:00
commit 755b19e043
6 changed files with 44 additions and 14 deletions

View File

@ -339,6 +339,7 @@
--------------------------------------------------------------------------------
Changes in version 5.1.42
--------------------------------------------------------------------------------
- use proxy when getting latest version
--------------------------------------------------------------------------------
Changes in version 5.1.41

View File

@ -397,7 +397,7 @@ $EXT_CONF = '.var_export($EXT_CONF, true).';');
return false;
return self::checkExtensionByName($extname, $extconf, $options);
}
} /* }}} */
/**
* Check content of extension directory or configuration of extension

View File

@ -28,12 +28,12 @@ class SeedDMS_LdapAuthentication extends SeedDMS_Authentication {
var $settings;
protected function addUser($username, $info) {
protected function addUser($username, $info) { /* {{{ */
$mailfield = !empty($this->settings->_ldapMailField) ? $this->settings->_ldapMailField : 'mail';
return $this->dms->addUser($username, null, $info['cn'][0], isset($info[$mailfield]) ? $info[$mailfield][0] : '', $this->settings->_language, $this->settings->_theme, "User was added from LDAP");
}
} /* }}} */
protected function updateUser($user, $info) {
protected function updateUser($user, $info) { /* {{{ */
$mailfield = !empty($this->settings->_ldapMailField) ? $this->settings->_ldapMailField : 'mail';
if(isset($info['cn'][0]) && ($info['cn'][0] != $user->getFullName())) {
$user->setFullName($info['cn'][0]);
@ -41,9 +41,9 @@ class SeedDMS_LdapAuthentication extends SeedDMS_Authentication {
if(isset($info[$mailfield][0]) && ($info[$mailfield][0] != $user->getEmail())) {
$user->setEmail($info[$mailfield][0]);
}
}
} /* }}} */
protected function syncGroups($user, $ldapgroups) {
protected function syncGroups($user, $ldapgroups) { /* {{{ */
$groupnames = [];
$count = 0;
if(isset($ldapgroups['count']))
@ -88,7 +88,7 @@ class SeedDMS_LdapAuthentication extends SeedDMS_Authentication {
}
}
}
}
} /* }}} */
public function __construct($dms, $settings) { /* {{{ */
$this->dms = $dms;

View File

@ -462,6 +462,29 @@ function getFilenameByDocname($content) { /* {{{ */
return mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $filename);
} /* }}} */
function getStreamContext($proxyurl, $proxyuser, $proxypass) { /* {{{ */
if(!$proxyurl)
return null;
$url = parse_url($proxyurl);
$opts = [
$url['scheme'] => [
'proxy' => 'tcp://'.$url['host'].($url['port'] ? ':'.$url['port'] : ''),
'request_fulluri' => true,
]
];
if($proxyuser && $proxypass) {
$auth = base64_encode($proxyurl.':'.$this->proxypass);
$opts[$url['scheme']] = [
'header' => [
'Proxy-Authorization: Basic '.$auth
]
];
}
$context = stream_context_create($opts);
return $context;
} /* }}} */
function getLogger($prefix='', $mask=PEAR_LOG_INFO) { /* {{{ */
global $settings;

View File

@ -34,10 +34,10 @@ if (!$accessop->check_view_access($view, $_GET)) {
UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
}
$reposurl = $settings->_repositoryUrl;
//$reposurl = $settings->_repositoryUrl;
//$extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir, $reposurl);
$v = new SeedDMS_Version;
$extmgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir, $reposurl);
if(isset($_GET['currenttab']))
$currenttab = $_GET['currenttab'];
else
@ -52,7 +52,7 @@ if($view) {
$view->setParam('extdir', $settings->_rootDir."/ext");
$view->setParam('version', $v);
$view->setParam('accessobject', $accessop);
$view->setParam('extmgr', $extmgr);
$view->setParam('extmgr', $extMgr);
$view->setParam('currenttab', $currenttab);
$view->setParam('extname', $extname);
$view->setParam('reposurl', $reposurl);

View File

@ -39,8 +39,14 @@ if (!$accessop->check_view_access($view, $_GET)) {
$v = new SeedDMS_Version;
$versions = array();
if($settings->_proxyUrl)
$context = getStreamContext($settings->_proxyUrl, $settings->_proxyUser, $settings->_proxyPassword);
else
$context = null;
if(@ini_get('allow_url_fopen') == '1') {
$lines = @file('http://www.seeddms.org/latest?version='.$v->version(), FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES);
$lines = @file('http://www.seeddms.org/latest?version='.$v->version(), FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES, $context);
if($lines) {
foreach($lines as $line) {
$versions[] = explode(':', $line);
@ -48,14 +54,14 @@ if(@ini_get('allow_url_fopen') == '1') {
}
}
$reposurl = $settings->_repositoryUrl;
$extmgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir, $reposurl);
//$reposurl = $settings->_repositoryUrl;
//$extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir, $reposurl);
if($view) {
$view->setParam('version', $v);
$view->setParam('availversions', $versions);
$view->setParam('accessobject', $accessop);
$view->setParam('extmgr', $extmgr);
$view->setParam('extmgr', $extMgr);
$view($_GET);
exit;
}