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

This commit is contained in:
Uwe Steinmann 2021-07-23 14:07:03 +02:00
commit cb0c51234e
7 changed files with 403 additions and 330 deletions

View File

@ -41,8 +41,18 @@ The fastes way to get SeedDMS running is by unpacking the archive
Let's assume you use seeddms-quickstart-5.1.10.tar.gz.
It will create a new directory `seeddms51x` containing everything you
need to run SeedDMS with sqlite3.
Setting up the web server
--------------------------
First you will need to set up your web server. Here, we will only focus
on apache.
Either let the document root of your web server point to the directory `www`
below `seeddms51x` or add an alias. For apache this could be like
below `seeddms51x`
DocumentRoot /var/www/seeddms51x/www
or add an alias. For apache this could be like
Alias /seeddms51x /<some directory>/seeddms51x/www
@ -52,11 +62,16 @@ Alias /mydms /<some directory>/seeddms51x/www
Do not set the DocumentRoot or Alias to
the `seeddms51x` directory, because this will allow anybody to access
your `data` and `conf` directory. This is a major security risk.
your `data` and `conf` directory if it is not secured by a .htaccess file.
This is a major security risk.
Make sure that the subdirectory `seeddms51x/data` and the configuration file
`seeddms51/conf/settings.xml` is writeable by your web server. All other
directories must just be readable by your web server.
directories can be just readable by your web server, though it is advisable
to even protect them from writing.
Adjusting the configuration of SeedDMS
---------------------------------------
In the next step you need to adjust the configuration file in
`seeddms51x/conf/settings.xml`. Open the file in your favorite text editor
@ -71,7 +86,7 @@ It will first ask to unlock the installer by creating a file
`ENABLE_INSTALL_TOOL` in the diretory `seeddms51x/conf/`. Change all paths by
replacing `/home/www-data` with your base directory where you put seeddms51x.
Set httpRoot to '/' (if the document root points to`seeddms51x/www`) or
'/seeddms51x' (if you have set an alias like described above).
'/seeddms51x' (if you have set an alias `seeddms51x` like described above).
Once your configuration is done,
save it, remove the file `ENABLE_INSTALL_TOOL` and point your browser to

View File

@ -1356,6 +1356,7 @@ class Settings { /* {{{ */
// TODO
// $this->_coreDir
/*
if($this->_coreDir) {
if (!file_exists($this->_coreDir ."Core.php")) {
$result["coreDir"] = array(
@ -1376,7 +1377,7 @@ class Settings { /* {{{ */
);
}
}
*/
// $this->_httpRoot
$tmp = $this->curPageURL();
$tmp = str_replace ("install.php", "" , $tmp);
@ -1527,7 +1528,7 @@ class Settings { /* {{{ */
if(!empty($this->_coreDir))
require_once($this->_coreDir.'/Core.php');
else
require_once('SeedDMS/Core.php');
require_once($this->_rootDir.'../pear/SeedDMS/Core.php');
$tmpcore = new SeedDMS_Core_DMS(null, $this->_contentDir);
$db = new SeedDMS_Core_DatabaseAccess($this->_dbDriver, $this->_dbHostname, $this->_dbUser, $this->_dbPass, $this->_dbDatabase);
if(!$db->connect()) {
@ -1590,7 +1591,7 @@ class Settings { /* {{{ */
}
// Check PHP version
if (version_compare(PHP_VERSION, '5.6.38') < 0) {
if (version_compare(PHP_VERSION, '7.2.5') < 0) {
$result["php_version"] = array(
"status" => "versiontolow",
"type" => "error",
@ -1600,6 +1601,15 @@ class Settings { /* {{{ */
// Check PHP configuration
$loaded_extensions = get_loaded_extensions();
// xml
if (!in_array("xml", $loaded_extensions)) {
$result["php_xml"] = array(
"status" => "notfound",
"type" => "error",
"suggestion" => "activate_php_extension"
);
}
// gd2
if (!in_array("gd", $loaded_extensions)) {
$result["php_gd2"] = array(
@ -1618,6 +1628,42 @@ class Settings { /* {{{ */
);
}
// json
if (!in_array("json", $loaded_extensions)) {
$result["php_json"] = array(
"status" => "notfound",
"type" => "error",
"suggestion" => "activate_php_extension"
);
}
// zip
if (!in_array("zip", $loaded_extensions)) {
$result["php_zip"] = array(
"status" => "notfound",
"type" => "error",
"suggestion" => "activate_php_extension"
);
}
// fileinfo
if (!in_array("fileinfo", $loaded_extensions)) {
$result["php_fileinfo"] = array(
"status" => "notfound",
"type" => "error",
"suggestion" => "activate_php_extension"
);
}
// sqlite3
if (!in_array("sqlite3", $loaded_extensions)) {
$result["php_sqlite3"] = array(
"status" => "notfound",
"type" => "error",
"suggestion" => "activate_php_extension"
);
}
// database
if (!in_array('pdo_'.$this->_dbDriver, $loaded_extensions)) {
$result["php_dbDriver"] = array(
@ -1641,6 +1687,7 @@ class Settings { /* {{{ */
*/
// Check for HTTP/WebDAV/Server.php
/*
if (!Settings::findInIncPath('HTTP/WebDAV/Server.php')) {
$result["pear_webdav"] = array(
"status" => "notfound",
@ -1648,8 +1695,10 @@ class Settings { /* {{{ */
"suggestion" => "install_pear_package_webdav"
);
}
*/
// Check for Zend/Search/Lucene.php
/*
if (!Settings::findInIncPath('Zend/Search/Lucene.php')) {
$result["zendframework"] = array(
"status" => "notfound",
@ -1657,6 +1706,7 @@ class Settings { /* {{{ */
"suggestion" => "install_zendframework"
);
}
*/
return $result;
} /* }}} */

View File

@ -35,11 +35,13 @@ if(!trim($settings->_encryptionKey)) {
$settings->save();
}
if(isset($settings->_extraPath))
ini_set('include_path', $settings->_rootDir.'pear'. PATH_SEPARATOR .ini_get('include_path'));
if(!empty($settings->_extraPath)) {
ini_set('include_path', $settings->_extraPath. PATH_SEPARATOR .ini_get('include_path'));
/* composer is installed in pear directory */
require_once 'vendor/autoload.php';
}
/* composer is installed in pear directory, but install tool does not need it */
if(!defined("SEEDDMS_INSTALL"))
require_once $settings->_rootDir.'../pear/vendor/autoload.php';
if(isset($settings->_maxExecutionTime)) {
if (php_sapi_name() !== "cli") {
@ -67,3 +69,7 @@ if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
* relative to it.
*/
ini_set('include_path', $settings->_rootDir. PATH_SEPARATOR .ini_get('include_path'));
/* Add root Dir.'../pear'. Needed because the SeedDMS_Core, etc. are included
* relative to it.
*/
ini_set('include_path', $settings->_rootDir.'../pear'. PATH_SEPARATOR .ini_get('include_path'));

View File

@ -2,6 +2,62 @@
include("../views/bootstrap/class.Bootstrap.php");
class SeedDMS_View_Install extends SeedDMS_Theme_Style {
protected function printError($error) { /* {{{ */
print "<div class=\"alert alert-error\">\n";
print $error;
print "</div>";
} /* }}} */
protected function printWarning($error) { /* {{{ */
print "<div class=\"alert alert-warning\">";
print $error;
print "</div>";
} /* }}} */
protected function printCheckError($resCheck) { /* {{{ */
$hasError = false;
foreach($resCheck as $keyRes => $paramRes) {
if(isset($paramRes['type']) && $paramRes['type'] == 'error')
$hasError = true;
$errorMes = getMLText("settings_$keyRes"). " : " . getMLText("settings_".$paramRes["status"]);
if (isset($paramRes["currentvalue"]))
$errorMes .= "<br/> =&gt; " . getMLText("settings_currentvalue") . " : " . $paramRes["currentvalue"];
if (isset($paramRes["suggestionvalue"]))
$errorMes .= "<br/> =&gt; " . getMLText("settings_suggestionvalue") . " : " . $paramRes["suggestionvalue"];
if (isset($paramRes["suggestion"]))
$errorMes .= "<br/> =&gt; " . getMLText("settings_".$paramRes["suggestion"]);
if (isset($paramRes["systemerror"]))
$errorMes .= "<br/> =&gt; " . $paramRes["systemerror"];
if(isset($paramRes['type']) && $paramRes['type'] == 'error')
$this->printError($errorMes);
else
$this->printWarning($errorMes);
}
return $hasError;
} /* }}} */
protected function openDBConnection($settings) { /* {{{ */
switch($settings->_dbDriver) {
case 'mysql':
case 'mysqli':
case 'mysqlnd':
case 'pgsql':
$tmp = explode(":", $settings->_dbHostname);
$dsn = $settings->_dbDriver.":dbname=".$settings->_dbDatabase.";host=".$tmp[0];
if(isset($tmp[1]))
$dsn .= ";port=".$tmp[1];
break;
case 'sqlite':
$dsn = $settings->_dbDriver.":".$settings->_dbDatabase;
break;
}
$connTmp = new PDO($dsn, $settings->_dbUser, $settings->_dbPass);
return $connTmp;
} /* }}} */
public function intro() { /* {{{ */
$this->htmlStartPage("INSTALL");
$this->globalBanner();
@ -16,7 +72,7 @@ echo '<p><a href="install.php">' . getMLText("settings_start_install") . '</a></
$this->htmlEndPage();
} /* }}} */
public function install() { /* {{{ */
public function install($msg) { /* {{{ */
$settings = $this->params['settings'];
$configDir = $this->params['configdir'];
@ -25,7 +81,7 @@ echo '<p><a href="install.php">' . getMLText("settings_start_install") . '</a></
$this->contentStart();
$this->contentHeading("SeedDMS Installation for version ".SEEDDMS_VERSION);
if(isset($msg))
echo "<div class=\"alert alert-warning\">".$msg."</div>";
$this->warningMsg($msg);
$this->contentContainerStart();
@ -69,7 +125,7 @@ echo '<p><a href="install.php">' . getMLText("settings_start_install") . '</a></
/**
* Check System
*/
if (printCheckError( $settings->checkSystem())) { /* {{{ */
if ($this->printCheckError( $settings->checkSystem())) { /* {{{ */
if (function_exists("apache_get_version")) {
echo "<br/>Apache version: " . apache_get_version();
}
@ -87,13 +143,12 @@ if (printCheckError( $settings->checkSystem())) { /* {{{ */
exit;
} /* }}} */
if (isset($_POST["action"])) $action=$_POST["action"];
else if (isset($_GET["action"])) $action=$_GET["action"];
else $action=NULL;
$showform = true;
if ($action=="setSettings") {
if ($action=="setSettings") { /* {{{ */
/**
* Get Parameters
*/
@ -109,8 +164,8 @@ if ($action=="setSettings") {
$settings->_dbDatabase = $_POST["dbDatabase"];
$settings->_dbUser = $_POST["dbUser"];
$settings->_dbPass = $_POST["dbPass"];
$settings->_coreDir = $_POST["coreDir"];
$settings->_luceneClassDir = $_POST["luceneClassDir"];
$settings->_coreDir = ''; //$_POST["coreDir"];
$settings->_luceneClassDir = ''; //$_POST["luceneClassDir"];
if(isset($settings->_extraPath))
ini_set('include_path', $settings->_extraPath. PATH_SEPARATOR .ini_get('include_path'));
@ -118,7 +173,7 @@ if ($action=="setSettings") {
/**
* Check Parameters, require version 3.3.x
*/
$hasError = printCheckError( $settings->check(substr(str_replace('.', '', SEEDDMS_VERSION), 0,2)));
$hasError = $this->printCheckError( $settings->check(substr(str_replace('.', '', SEEDDMS_VERSION), 0,2)));
if (!$hasError) {
// Create database
@ -126,7 +181,7 @@ if ($action=="setSettings") {
$createOK = false;
$errorMsg = "";
$connTmp =openDBConnection($settings);
$connTmp = $this->openDBConnection($settings);
if ($connTmp) {
// read SQL file
if ($settings->_dbDriver=="mysql")
@ -174,7 +229,7 @@ if ($action=="setSettings") {
$settings->save();
$needsupdate = false;
$connTmp =openDBConnection($settings);
$connTmp = $this->openDBConnection($settings);
if ($connTmp) {
switch($settings->_dbDriver) {
case 'mysql':
@ -241,9 +296,9 @@ if ($action=="setSettings") {
echo '<br/>';
// echo '<a href="' . $httpRoot . '/install/install.php">' . getMLText("back") . '</a>';
}
} /* }}} */
if($showform) {
if($showform) { /* {{{ */
/**
* Set parameters
@ -278,6 +333,7 @@ if($showform) {
<td><?php printMLText("settings_cacheDir");?>:</td>
<td><input type="text" name="cacheDir" value="<?php echo $settings->_cacheDir ?>" size="100" style="background:yellow" /></td>
</tr>
<!--
<tr title="<?php printMLText("settings_coreDir_desc");?>">
<td><?php printMLText("settings_coreDir");?>:</td>
<td><input type="text" name="coreDir" value="<?php echo $settings->_coreDir ?>" size="100" /></td>
@ -286,6 +342,7 @@ if($showform) {
<td><?php printMLText("settings_luceneClassDir");?>:</td>
<td><input type="text" name="luceneClassDir" value="<?php echo $settings->_luceneClassDir ?>" size="100" /></td>
</tr>
-->
<tr title="<?php printMLText("settings_extraPath_desc");?>">
<td><?php printMLText("settings_extraPath");?>:</td>
<td><input type="text" name="extraPath" value="<?php echo $settings->_extraPath ?>" size="100" /></td>
@ -328,15 +385,12 @@ if($showform) {
</form>
<?php
}
/*
*/
} /* }}} */
// just remove info for web page installation
$settings->_printDisclaimer = false;
$settings->_footNote = false;
// end of the page
$this->contentContainerEnd();
$this->contentEnd();

View File

@ -46,66 +46,6 @@ if (!file_exists("settings.xml.template_install")) {
exit;
}
/**
* Functions
*/
function openDBConnection($settings) { /* {{{ */
switch($settings->_dbDriver) {
case 'mysql':
case 'mysqli':
case 'mysqlnd':
case 'pgsql':
$tmp = explode(":", $settings->_dbHostname);
$dsn = $settings->_dbDriver.":dbname=".$settings->_dbDatabase.";host=".$tmp[0];
if(isset($tmp[1]))
$dsn .= ";port=".$tmp[1];
break;
case 'sqlite':
$dsn = $settings->_dbDriver.":".$settings->_dbDatabase;
break;
}
$connTmp = new PDO($dsn, $settings->_dbUser, $settings->_dbPass);
return $connTmp;
} /* }}} */
function printError($error) { /* {{{ */
print "<div class=\"alert alert-error\">\n";
print $error;
print "</div>";
} /* }}} */
function printWarning($error) { /* {{{ */
print "<div class=\"install_warning\">";
print "Warning<br />";
print $error;
print "</div>";
} /* }}} */
function printCheckError($resCheck) { /* {{{ */
$hasError = false;
foreach($resCheck as $keyRes => $paramRes) {
if(isset($paramRes['type']) && $paramRes['type'] == 'error')
$hasError = true;
$errorMes = getMLText("settings_$keyRes"). " : " . getMLText("settings_".$paramRes["status"]);
if (isset($paramRes["currentvalue"]))
$errorMes .= "<br/> =&gt; " . getMLText("settings_currentvalue") . " : " . $paramRes["currentvalue"];
if (isset($paramRes["suggestionvalue"]))
$errorMes .= "<br/> =&gt; " . getMLText("settings_suggestionvalue") . " : " . $paramRes["suggestionvalue"];
if (isset($paramRes["suggestion"]))
$errorMes .= "<br/> =&gt; " . getMLText("settings_".$paramRes["suggestion"]);
if (isset($paramRes["systemerror"]))
$errorMes .= "<br/> =&gt; " . $paramRes["systemerror"];
if(isset($paramRes['type']) && $paramRes['type'] == 'error')
printError($errorMes);
else
printWarning($errorMes);
}
return $hasError;
} /* }}} */
function fileExistsInIncludePath($file) { /* {{{ */
$paths = explode(PATH_SEPARATOR, get_include_path());
$found = false;
@ -170,12 +110,13 @@ do {
$httpRoot = str_replace ("//", "/" , $httpRoot, $count);
} while ($count<>0);
$msg = '';
if($rootDir != $settings->_rootDir) {
$msg = "Your Root directory has been modified to fit your installation path!";
}
$settings->_rootDir = $rootDir;
if(!$settings->_contentDir) {
if(!$settings->_contentDir || !is_dir($settings->_contentDir)) {
$settings->_contentDir = realpath($settings->_rootDir."..") . '/data/';
$settings->_luceneDir = $settings->_contentDir . 'lucene/';
$settings->_stagingDir = $settings->_contentDir . 'staging/';
@ -186,6 +127,11 @@ if(!$settings->_contentDir) {
$settings->_cacheDir = $settings->_contentDir . 'cache/';
}
}
if($settings->_dbDriver == 'sqlite') {
if(!$settings->_dbDatabase || !file_exists($settings->_dbDatabase)) {
$settings->_dbDatabase = $settings->_contentDir.'content.db';
}
}
$settings->_httpRoot = $httpRoot;
if(isset($settings->_extraPath))
@ -201,5 +147,5 @@ include("../inc/inc.ClassUI.php");
include("class.Install.php");
$view = new SeedDMS_View_Install(array('settings'=>$settings, 'session'=>null, 'sitename'=>'SeedDMS', 'printdisclaimer'=>0, 'showmissingtranslations'=>0, 'absbaseprefix'=>'/', 'enabledropfolderlist'=>0, 'enablemenutasks'=>0, 'configdir'=>$configDir));
$view->install();
?>
$view->install($msg);

View File

@ -97,7 +97,7 @@ if(!$controller->run()) {
$user = $controller->getUser();
if (isset($referuri) && strlen($referuri)>0) {
header("Location: " . getBaseUrl() . "/" . $referuri);
header("Location: " . getBaseUrl() . $referuri);
}
else {
header("Location: ".$settings->_httpRoot.(isset($settings->_siteDefaultPage) && strlen($settings->_siteDefaultPage)>0 ? $settings->_siteDefaultPage : "out/out.ViewFolder.php?folderid=".($user->getHomeFolder() ? $user->getHomeFolder() : $settings->_rootFolderID)));

View File

@ -52,8 +52,8 @@ class SeedDMS_View_EditAttributes extends SeedDMS_Theme_Style {
<input type="hidden" name="version" value="<?php print $version->getVersion();?>">
<?php
$this->contentContainerStart();
if($attrdefs) {
$this->contentContainerStart();
foreach($attrdefs as $attrdef) {
$arr = $this->callHook('editDocumentContentAttribute', $version, $attrdef);
if(is_array($arr)) {
@ -66,7 +66,6 @@ class SeedDMS_View_EditAttributes extends SeedDMS_Theme_Style {
$this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, $version->getAttribute($attrdef)));
}
}
}
$arrs = $this->callHook('addDocumentContentAttributes', $version);
if(is_array($arrs)) {
foreach($arrs as $arr) {
@ -77,6 +76,9 @@ class SeedDMS_View_EditAttributes extends SeedDMS_Theme_Style {
}
$this->contentContainerEnd();
$this->formSubmit("<i class=\"fa fa-save\"></i> ".getMLText('save'));
} else {
$this->warningMsg(getMLText('no_attributes_defined'));
}
?>
</form>
<?php