diff --git a/CHANGELOG b/CHANGELOG index e5eca071a..3a52863a1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -339,6 +339,7 @@ -------------------------------------------------------------------------------- Changes in version 5.1.42 -------------------------------------------------------------------------------- +- use proxy when getting latest version -------------------------------------------------------------------------------- Changes in version 5.1.41 diff --git a/inc/inc.ClassExtensionMgr.php b/inc/inc.ClassExtensionMgr.php index f8f0a06ca..63e633256 100644 --- a/inc/inc.ClassExtensionMgr.php +++ b/inc/inc.ClassExtensionMgr.php @@ -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 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; diff --git a/inc/inc.Utils.php b/inc/inc.Utils.php index 301bdb447..8a91b2ad7 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; diff --git a/out/out.ExtensionMgr.php b/out/out.ExtensionMgr.php index 3802eb5ea..9c545bd75 100644 --- a/out/out.ExtensionMgr.php +++ b/out/out.ExtensionMgr.php @@ -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); diff --git a/out/out.Info.php b/out/out.Info.php index 557b78a91..0c15a94e5 100644 --- a/out/out.Info.php +++ b/out/out.Info.php @@ -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; }