mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 07:04:57 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
756a86abe5
|
@ -133,6 +133,7 @@
|
|||
- Do not use unzip in ExtensionMgr anymore
|
||||
- fix version compare on info page
|
||||
- allow one page mode on search page
|
||||
- fix import of older extension versions from repository
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Changes in version 5.1.14
|
||||
|
|
|
@ -103,10 +103,13 @@ class SeedDMS_Extension_Mgr {
|
|||
* configuration file if it does not exist and the extension dir
|
||||
* is given
|
||||
*/
|
||||
public function __construct($extdir = '', $cachedir = '', $reposurl = '') { /* {{{ */
|
||||
public function __construct($extdir = '', $cachedir = '', $reposurl = '', $proxyurl='', $proxyuser='', $proxypass='') { /* {{{ */
|
||||
$this->cachedir = $cachedir;
|
||||
$this->extdir = $extdir;
|
||||
$this->reposurl = $reposurl;
|
||||
$this->proxyurl = $proxyurl;
|
||||
$this->proxyuser = $proxyuser;
|
||||
$this->proxypass = $proxypass;
|
||||
$this->extconf = array();
|
||||
if($extdir) {
|
||||
if(!file_exists($this->getExtensionsConfFile())) {
|
||||
|
@ -123,6 +126,29 @@ class SeedDMS_Extension_Mgr {
|
|||
return $this->reposurl;
|
||||
} /* }}} */
|
||||
|
||||
private function getStreamContext() { /* {{{ */
|
||||
if(!$this->proxyurl)
|
||||
return null;
|
||||
$url = parse_url($this->proxyurl);
|
||||
$opts = [
|
||||
$url['scheme'] => [
|
||||
'proxy' => 'tcp://'.$url['host'].($url['port'] ? ':'.$url['port'] : ''),
|
||||
'request_fulluri' => true,
|
||||
]
|
||||
];
|
||||
if($this->proxyuser && $this->proxypass) {
|
||||
$auth = base64_encode($this->proxyurl.':'.$this->proxypass);
|
||||
$opts[$url['scheme']] = [
|
||||
'header' => [
|
||||
'Proxy-Authorization: Basic '.$auth
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
$context = stream_context_create($opts);
|
||||
return $context;
|
||||
} /* }}} */
|
||||
|
||||
protected function getExtensionsConfFile() { /* {{{ */
|
||||
return $this->cachedir."/extensions.php";
|
||||
} /* }}} */
|
||||
|
@ -544,7 +570,7 @@ class SeedDMS_Extension_Mgr {
|
|||
public function updateExtensionList($version='', $force=false) { /* {{{ */
|
||||
if($this->reposurl) {
|
||||
if(!file_exists($this->cachedir."/".self::repos_list_file) || $force) {
|
||||
if($file = @file_get_contents($this->reposurl.($version ? '?seeddms_version='.$version : ''))) {
|
||||
if($file = @file_get_contents($this->reposurl.($version ? '?seeddms_version='.$version : ''), false, $this->getStreamContext())) {
|
||||
if(is_array($http_response_header)) {
|
||||
$parts=explode(' ',$http_response_header[0]);
|
||||
if(count($parts)>1) //HTTP/1.0 <code> <text>
|
||||
|
@ -564,6 +590,18 @@ class SeedDMS_Extension_Mgr {
|
|||
}
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Download an extension from the repository
|
||||
*
|
||||
* @param string $file filename of extension
|
||||
*/
|
||||
public function getExtensionFromRepository($file) { /* {{{ */
|
||||
$content = file_get_contents($this->reposurl."/".$file, false, $this->getStreamContext());
|
||||
$tmpfile = tempnam(sys_get_temp_dir(), '');
|
||||
file_put_contents($tmpfile, $content);
|
||||
return $tmpfile;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Return last error message
|
||||
*
|
||||
|
|
|
@ -577,6 +577,9 @@ class Settings { /* {{{ */
|
|||
$this->_checkOutDir = strval($tab["checkOutDir"]);
|
||||
$this->_createCheckOutDir = Settings::boolVal($tab["createCheckOutDir"]);
|
||||
$this->_repositoryUrl = strval($tab["repositoryUrl"]);
|
||||
$this->_proxyUrl = strval($tab["proxyUrl"]);
|
||||
$this->_proxyUser = strval($tab["proxyUser"]);
|
||||
$this->_proxyPassword = strval($tab["proxyPassword"]);
|
||||
$this->_logFileEnable = Settings::boolVal($tab["logFileEnable"]);
|
||||
$this->_logFileRotation = strval($tab["logFileRotation"]);
|
||||
$this->_enableLargeFileUpload = Settings::boolVal($tab["enableLargeFileUpload"]);
|
||||
|
@ -941,6 +944,9 @@ class Settings { /* {{{ */
|
|||
$this->setXMLAttributValue($node, "checkOutDir", $this->_checkOutDir);
|
||||
$this->setXMLAttributValue($node, "createCheckOutDir", $this->_createCheckOutDir);
|
||||
$this->setXMLAttributValue($node, "repositoryUrl", $this->_repositoryUrl);
|
||||
$this->setXMLAttributValue($node, "proxyUrl", $this->_proxyUrl);
|
||||
$this->setXMLAttributValue($node, "proxyUser", $this->_proxyUser);
|
||||
$this->setXMLAttributValue($node, "proxyPassword", $this->_proxyPassword);
|
||||
$this->setXMLAttributValue($node, "logFileEnable", $this->_logFileEnable);
|
||||
$this->setXMLAttributValue($node, "logFileRotation", $this->_logFileRotation);
|
||||
$this->setXMLAttributValue($node, "enableLargeFileUpload", $this->_enableLargeFileUpload);
|
||||
|
|
|
@ -17,7 +17,7 @@ require_once "inc.ClassExtBase.php";
|
|||
require_once "inc.Version.php";
|
||||
require_once "inc.Utils.php";
|
||||
|
||||
$extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir, $settings->_repositoryUrl);
|
||||
$extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir, $settings->_repositoryUrl, $settings->_proxyUrl, $settings->_proxyUser, $settings->_proxyPassword);
|
||||
|
||||
$version = new SeedDMS_Version;
|
||||
|
||||
|
|
|
@ -95,10 +95,13 @@ elseif ($action == "import") { /* {{{ */
|
|||
if(!$_POST['url']) {
|
||||
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
|
||||
}
|
||||
$file = $extMgr->getExtensionFromRepository($_POST['url']);
|
||||
/*
|
||||
$reposurl = $settings->_repositoryUrl;
|
||||
$content = file_get_contents($reposurl."/".$_POST['url']);
|
||||
$file = tempnam(sys_get_temp_dir(), '');
|
||||
file_put_contents($file, $content);
|
||||
*/
|
||||
|
||||
// $extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir);
|
||||
$controller->setParam('extmgr', $extMgr);
|
||||
|
|
|
@ -77,7 +77,7 @@ class SeedDMS_View_ExtensionMgr extends SeedDMS_Bootstrap_Style {
|
|||
});
|
||||
});
|
||||
|
||||
$('a.import').click(function(ev){
|
||||
$('body').on('click', 'a.import', function(ev){
|
||||
var element = $(this);
|
||||
$('#'+element.data('extname')+'-import').submit();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user