diff --git a/CHANGELOG b/CHANGELOG index 88cba81b0..2f1e1de6a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -105,6 +105,7 @@ - do not list empty groups as reviewer/approver - fix sending notification when document attributes change - sending notification when folder attributes change +- check if converters are set in out/out.ViewDocument.php at all (Closes #394) -------------------------------------------------------------------------------- Changes in version 5.1.6 diff --git a/controllers/class.ExtensionMgr.php b/controllers/class.ExtensionMgr.php new file mode 100644 index 000000000..9cae083e4 --- /dev/null +++ b/controllers/class.ExtensionMgr.php @@ -0,0 +1,81 @@ + + * @copyright Copyright (C) 2018 Uwe Steinmann + * @version Release: @package_version@ + */ + +/** + * Class which does the busines logic for managing extensions + * + * @category DMS + * @package SeedDMS + * @author Uwe Steinmann + * @copyright Copyright (C) 2018 Uwe Steinmann + * @version Release: @package_version@ + */ +class SeedDMS_Controller_ExtensionMgr extends SeedDMS_Controller_Common { + + public function refresh() { /* {{{ */ + $dms = $this->params['dms']; + $extmgr = $this->params['extmgr']; + + $extmgr->createExtensionConf(); + return true; + } /* }}} */ + + public function download() { /* {{{ */ + $dms = $this->params['dms']; + $settings = $this->params['settings']; + $extmgr = $this->params['extmgr']; + $extname = $this->params['extname']; + + $filename = $extmgr->createArchive($extname, $GLOBALS['EXT_CONF'][$extname]['version']); + + if(null === $this->callHook('download')) { + if(file_exists($filename)) { + header("Content-Transfer-Encoding: binary"); + header("Content-Length: " . filesize($filename)); + header("Content-Disposition: attachment; filename=\"" . utf8_basename($filename) . "\"; filename*=UTF-8''".utf8_basename($filename)); + header("Content-Type: application/zip"); + header("Cache-Control: must-revalidate"); + + sendFile($filename); + } + } + return true; + } /* }}} */ + + public function upload() { /* {{{ */ + $dms = $this->params['dms']; + $extmgr = $this->params['extmgr']; + $file = $this->params['file']; + + if($extmgr->updateExtension($file)) + $extmgr->createExtensionConf(); + else + return false; + return true; + } /* }}} */ + + public function getlist() { /* {{{ */ + $dms = $this->params['dms']; + $extmgr = $this->params['extmgr']; + $forceupdate = $this->params['forceupdate']; + $version = $this->params['version']; + + if(!$extmgr->updateExtensionList($version, $forceupdate)) { + $this->errormsg = $extmgr->getErrorMsg(); + return false; + } + + return true; + } /* }}} */ + +} diff --git a/ext/example/changelog.md b/ext/example/changelog.md index aa8f298be..f043a9089 100644 --- a/ext/example/changelog.md +++ b/ext/example/changelog.md @@ -1,2 +1,9 @@ +Changes in version 1.0.1 +========================== + +- added this changelog file + Changes in version 1.0.0 ========================== + +- Initial version diff --git a/ext/example/conf.php b/ext/example/conf.php index dc9a58841..ac21c1f58 100644 --- a/ext/example/conf.php +++ b/ext/example/conf.php @@ -2,9 +2,9 @@ $EXT_CONF['example'] = array( 'title' => 'Example Extension', 'description' => 'This sample extension demonstrates the use of various hooks', - 'disable' => true, - 'version' => '1.0.0', - 'releasedate' => '2013-05-03', + 'disable' => false, + 'version' => '1.0.1', + 'releasedate' => '2018-03-21', 'author' => array('name'=>'Uwe Steinmann', 'email'=>'uwe@steinmann.cx', 'company'=>'MMK GmbH'), 'config' => array( 'input_field' => array( diff --git a/inc/inc.ClassExtensionMgr.php b/inc/inc.ClassExtensionMgr.php index 018847491..3f600891d 100644 --- a/inc/inc.ClassExtensionMgr.php +++ b/inc/inc.ClassExtensionMgr.php @@ -60,7 +60,8 @@ class SeedDMS_Extension_Mgr { /** * Compare two version * - * This functions compares two version in the format x.x.x + * This functions compares two version in the format x.x.x with x being + * an integer * * @param string $ver1 * @param string $ver2 @@ -107,7 +108,7 @@ class SeedDMS_Extension_Mgr { $this->createExtensionConf(); } include($this->getExtensionsConfFile()); - if($EXT_CONF) { + if(!empty($EXT_CONF)) { $this->extconf = $EXT_CONF; } } @@ -372,10 +373,18 @@ class SeedDMS_Extension_Mgr { * * @param boolean $force force download even if file already exists */ - public function updateExtensionList($force=false) { /* {{{ */ + public function updateExtensionList($version='', $force=false) { /* {{{ */ if($this->reposurl) { if(!file_exists($this->cachedir."/repository.json") || $force) { - $file = file_get_contents($this->reposurl); + $file = @file_get_contents($this->reposurl.($version ? '?seeddms_version='.$version : '')); + if(is_array($http_response_header)) { + $parts=explode(' ',$http_response_header[0]); + if(count($parts)>1) //HTTP/1.0 + if(intval($parts[1]) != 200) { + $this->errmsgs[] = 'Getting extension list returned http code ('.$parts[1].')'; + return false; + } + } file_put_contents($this->cachedir."/repository.json", $file); } return true; diff --git a/inc/inc.Extension.php b/inc/inc.Extension.php index c72458b28..b5ba1c203 100644 --- a/inc/inc.Extension.php +++ b/inc/inc.Extension.php @@ -16,7 +16,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); +$extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir, $settings->_repositoryUrl); $EXT_CONF = $extMgr->getExtensionConfiguration(); $version = new SeedDMS_Version; diff --git a/op/op.ExtensionMgr.php b/op/op.ExtensionMgr.php index 7fcbe569c..29fe71001 100644 --- a/op/op.ExtensionMgr.php +++ b/op/op.ExtensionMgr.php @@ -95,7 +95,7 @@ elseif ($action == "import") { /* {{{ */ if(!$_POST['url']) { UI::exitError(getMLText("admin_tools"),getMLText("error_occured")); } - $reposurl = 'http://seeddms.steinmann.cx/repository'; + $reposurl = $settings->_repositoryUrl; $content = file_get_contents($reposurl."/".$_POST['url']); $file = tempnam(sys_get_temp_dir(), ''); file_put_contents($file, $content); @@ -113,6 +113,19 @@ elseif ($action == "import") { /* {{{ */ add_log_line(); header("Location:../out/out.ExtensionMgr.php?currenttab=".$currenttab); } /* }}} */ +elseif ($action == "getlist") { /* {{{ */ + $v = new SeedDMS_Version(); + $controller->setParam('extmgr', $extMgr); + $controller->setParam('forceupdate', (isset($_POST['forceupdate']) && $_POST['forceupdate']) ? true : false); + $controller->setParam('version', $v->version()); + if (!$controller($_POST)) { + $session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('error_extension_getlist').$controller->getErrorMsg(), 'timeout'=>5000)); + } else { + $session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_extension_getlist'))); + } + add_log_line(); + header("Location:../out/out.ExtensionMgr.php?currenttab=".$currenttab); +} /* }}} */ ?> diff --git a/out/out.ExtensionMgr.php b/out/out.ExtensionMgr.php index 5f444f3a7..bbc8fa826 100644 --- a/out/out.ExtensionMgr.php +++ b/out/out.ExtensionMgr.php @@ -42,11 +42,6 @@ if(isset($_GET['currenttab'])) else $currenttab = 'installed'; -if(isset($_GET['forceupdate']) && $_GET['forceupdate']==1) - $extmgr->updateExtensionList(true); -else - $extmgr->updateExtensionList(); - if($view) { $view->setParam('httproot', $settings->_httpRoot); $view->setParam('extdir', $settings->_rootDir."/ext"); diff --git a/out/out.ViewDocument.php b/out/out.ViewDocument.php index f29dbe72d..ea9799396 100644 --- a/out/out.ViewDocument.php +++ b/out/out.ViewDocument.php @@ -82,9 +82,9 @@ if($view) { $view->setParam('workflowmode', $settings->_workflowMode); $view->setParam('previewWidthList', $settings->_previewWidthList); $view->setParam('previewWidthDetail', $settings->_previewWidthDetail); - $view->setParam('previewConverters', $settings->_converters['preview']); + $view->setParam('previewConverters', isset($settings->_converters['preview']) ? $settings->_converters['preview'] : array()); + $view->setParam('pdfConverters', isset($settings->_converters['pdf']) ? $settings->_converters['pdf'] : array()); $view->setParam('checkOutDir', $settings->_checkOutDir); - $view->setParam('pdfConverters', isset($settings->_converters['pdf']) ? $settings->_converters['pdf'] : null); $view->setParam('showFullPreview', $settings->_showFullPreview); $view->setParam('convertToPdf', $settings->_convertToPdf); $view->setParam('currenttab', isset($_GET['currenttab']) ? $_GET['currenttab'] : ""); diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index 6c47d2ddf..b85064601 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -123,7 +123,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);; echo "0 ? " class=\"".$bodyClass."\"" : "").">\n"; if($this->params['session'] && $flashmsg = $this->params['session']->getSplashMsg()) { $this->params['session']->clearSplashMsg(); - echo "
".$flashmsg['msg']."
\n"; + echo "
".$flashmsg['msg']."
\n"; } foreach($hookObjs as $hookObj) { if (method_exists($hookObj, 'startBody')) { diff --git a/views/bootstrap/class.ExtensionMgr.php b/views/bootstrap/class.ExtensionMgr.php index 2f60bd842..fcc5378be 100644 --- a/views/bootstrap/class.ExtensionMgr.php +++ b/views/bootstrap/class.ExtensionMgr.php @@ -140,7 +140,7 @@ class SeedDMS_View_ExtensionMgr extends SeedDMS_Bootstrap_Style { echo "\"".$extname."\""; echo ""; echo "".$extconf['title']; - if($extconf['changelog'] && file_exists($extdir."/".$extname."/".$extconf['changelog'])) { + if(!empty($extconf['changelog']) && file_exists($extdir."/".$extname."/".$extconf['changelog'])) { echo $this->printPopupBox("", '
'.file_get_contents($extdir."/".$extname."/".$extconf['changelog'])."
", true); } echo "
".$extconf['description'].""; @@ -215,7 +215,15 @@ class SeedDMS_View_ExtensionMgr extends SeedDMS_Bootstrap_Style { } echo "\n"; ?> -
+
+
+ + + + + +
+