From 7d81f5b0f84e015ab26f65c8bdcbafed051503cd Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 3 Sep 2025 11:43:57 +0200 Subject: [PATCH 1/6] add method getStreamContext() --- inc/inc.Utils.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/inc/inc.Utils.php b/inc/inc.Utils.php index 79901007a..6d31dda82 100644 --- a/inc/inc.Utils.php +++ b/inc/inc.Utils.php @@ -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; From 61f4dfca4b47acde55e8702af78fb34ca8e67f8c Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 3 Sep 2025 11:44:31 +0200 Subject: [PATCH 2/6] add missing fold mark --- inc/inc.ClassExtensionMgr.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/inc.ClassExtensionMgr.php b/inc/inc.ClassExtensionMgr.php index 519014339..2d1c3a59e 100644 --- a/inc/inc.ClassExtensionMgr.php +++ b/inc/inc.ClassExtensionMgr.php @@ -393,7 +393,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 From 25fd07a945065dd8d5ab52bffe0da21dd19233a1 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 3 Sep 2025 11:45:16 +0200 Subject: [PATCH 3/6] use ExtensionMgr created in inc.Extension.php --- out/out.ExtensionMgr.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/out/out.ExtensionMgr.php b/out/out.ExtensionMgr.php index 19fef05f0..ccbb7a46c 100644 --- a/out/out.ExtensionMgr.php +++ b/out/out.ExtensionMgr.php @@ -34,10 +34,10 @@ if (!$user->isAdmin()) { 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); From b9de849ab8e684734a4c703253be08315e0d3699 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 3 Sep 2025 11:45:56 +0200 Subject: [PATCH 4/6] use ExtensionMgr created in inc.Extension.php, use proxy settings --- out/out.Info.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/out/out.Info.php b/out/out.Info.php index 04338665d..7376f7cbd 100644 --- a/out/out.Info.php +++ b/out/out.Info.php @@ -39,8 +39,14 @@ if (!$user->isAdmin()) { $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; } From 9dc430e94d9e198008fc365620625ed745fa4a7f Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 5 Sep 2025 08:07:28 +0200 Subject: [PATCH 5/6] add changes for 5.1.42 --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 52150361f..c586aac2a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ -------------------------------------------------------------------------------- Changes in version 5.1.42 -------------------------------------------------------------------------------- +- use proxy when getting latest version -------------------------------------------------------------------------------- Changes in version 5.1.41 From 5c9c02f5f2ba94a8897c211bfe5dd34f0e3352bc Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Sat, 6 Sep 2025 13:41:41 +0200 Subject: [PATCH 6/6] add fold marks --- inc/inc.ClassLdapAuthentication.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/inc/inc.ClassLdapAuthentication.php b/inc/inc.ClassLdapAuthentication.php index 9ac1944dc..5e292d8f5 100644 --- a/inc/inc.ClassLdapAuthentication.php +++ b/inc/inc.ClassLdapAuthentication.php @@ -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;