_luceneDir);
if($index) {
$indexconf['Indexer']::init($settings->_stopWordsFile);
- $index->addDocument(new $indexconf['IndexedDocument']($dms, $document, isset($settings->_converters['fulltext']) ? $settings->_converters['fulltext'] : null, true));
+ $index->addDocument(new $indexconf['IndexedDocument']($dms, $document, isset($settings->_converters['fulltext']) ? $settings->_converters['fulltext'] : null, !($filesize < $settings->_maxSizeForFullText)));
}
}
diff --git a/op/op.AddDocumentLink.php b/op/op.AddDocumentLink.php
index 306532428..3bd4cb7e3 100644
--- a/op/op.AddDocumentLink.php
+++ b/op/op.AddDocumentLink.php
@@ -3,6 +3,7 @@
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
// Copyright (C) 2010 Matteo Lucarelli
+// Copyright (C) 2010-2106 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/op/op.AddEvent.php b/op/op.AddEvent.php
index 915d25422..ff3309128 100644
--- a/op/op.AddEvent.php
+++ b/op/op.AddEvent.php
@@ -3,6 +3,7 @@
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
// Copyright (C) 2010 Matteo Lucarelli
+// Copyright (C) 2010-2106 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/op/op.AddFile.php b/op/op.AddFile.php
index 345838ee9..c18d41737 100644
--- a/op/op.AddFile.php
+++ b/op/op.AddFile.php
@@ -1,6 +1,7 @@
load($dms_session)) {
+ header('Content-Type: application/json');
echo json_encode(array('error'=>1));
exit;
}
@@ -47,6 +48,7 @@ if (isset($_COOKIE["mydms_session"])) {
/* Load user data */
$user = $dms->getUser($resArr["userID"]);
if (!is_object($user)) {
+ header('Content-Type: application/json');
echo json_encode(array('error'=>1));
exit;
}
@@ -65,6 +67,11 @@ if (isset($_COOKIE["mydms_session"])) {
$user = null;
}
+/* make sure the browser doesn't cache the output of this page.
+ * Edge doesn't if not explicitly told to not do it, see bug #280
+ */
+header("Cache-Control: no-cache,no-store");
+
$command = $_REQUEST["command"];
switch($command) {
case 'checkpwstrength': /* {{{ */
@@ -77,17 +84,21 @@ switch($command) {
$score = $ps->get_score();
if($settings->_passwordStrength) {
if($score >= $settings->_passwordStrength) {
+ header('Content-Type: application/json');
echo json_encode(array('error'=>0, 'strength'=>$score, 'score'=>$score/$settings->_passwordStrength, 'ok'=>1));
} else {
+ header('Content-Type: application/json');
echo json_encode(array('error'=>0, 'strength'=>$score, 'score'=>$score/$settings->_passwordStrength, 'ok'=>0));
}
} else {
+ header('Content-Type: application/json');
echo json_encode(array('error'=>0, 'strength'=>$score));
}
break; /* }}} */
case 'sessioninfo': /* {{{ */
if($user) {
+ header('Content-Type: application/json');
echo json_encode($resArr);
}
break; /* }}} */
@@ -161,6 +172,7 @@ switch($command) {
}
}
+ header('Content-Type: application/json');
echo json_encode($tree);
// echo json_encode(array(array('label'=>'test1', 'id'=>1, 'load_on_demand'=> true), array('label'=>'test2', 'id'=>2, 'load_on_demand'=> true)));
}
@@ -223,6 +235,14 @@ switch($command) {
}
break; /* }}} */
+ case 'clearclipboard': /* {{{ */
+ if($user) {
+ $session->clearClipboard();
+ header('Content-Type: application/json');
+ echo json_encode(array('success'=>true, 'message'=>getMLText('splash_cleared_clipboard')));
+ }
+ break; /* }}} */
+
case 'movefolder': /* {{{ */
if($user) {
if(!checkFormKey('movefolder', 'GET')) {
@@ -518,6 +538,7 @@ switch($command) {
}
if ($folder->getAccessMode($user) < M_READWRITE) {
+ header('Content-Type: application/json');
echo json_encode(array('success'=>false, 'message'=>getMLText("access_denied")));
exit;
}
@@ -525,6 +546,7 @@ switch($command) {
if($settings->_quota > 0) {
$remain = checkQuota($user);
if ($remain < 0) {
+ header('Content-Type: application/json');
echo json_encode(array('success'=>false, 'message'=>getMLText("quota_exceeded", array('bytes'=>SeedDMS_Core_File::format_filesize(abs($remain))))));
exit;
}
diff --git a/op/op.ApproveDocument.php b/op/op.ApproveDocument.php
index 30ae35235..29d4782e9 100644
--- a/op/op.ApproveDocument.php
+++ b/op/op.ApproveDocument.php
@@ -3,7 +3,7 @@
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
// Copyright (C) 2010 Matteo Lucarelli
-// Copyright (C) 2011 Uwe Steinmann
+// Copyright (C) 2010-2016 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/op/op.AttributeMgr.php b/op/op.AttributeMgr.php
index 187a982ae..253be177b 100644
--- a/op/op.AttributeMgr.php
+++ b/op/op.AttributeMgr.php
@@ -2,7 +2,7 @@
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
-// Copyright (C) 2009-2012 Uwe Steinmann
+// Copyright (C) 2010-2016 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/op/op.Categories.php b/op/op.Categories.php
index b40771729..e45e833d6 100644
--- a/op/op.Categories.php
+++ b/op/op.Categories.php
@@ -2,6 +2,7 @@
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
+// Copyright (C) 2010-2016 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/op/op.ChangePassword.php b/op/op.ChangePassword.php
index c0d05823c..c15da5a68 100644
--- a/op/op.ChangePassword.php
+++ b/op/op.ChangePassword.php
@@ -2,7 +2,7 @@
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
-// Copyright (C) 2010-2011 Uwe Steinmann
+// Copyright (C) 2010-2016 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/op/op.ClearCache.php b/op/op.ClearCache.php
index b5c00e5f0..a68e302fe 100644
--- a/op/op.ClearCache.php
+++ b/op/op.ClearCache.php
@@ -1,6 +1,6 @@
_cacheDir.'/*';
-system($cmd);
+$ret = null;
+system($cmd, $ret);
+if($ret)
+ $session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('error_clearcache')));
+else
+ $session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_clearcache')));
+
add_log_line("");
header("Location:../out/out.AdminTools.php");
diff --git a/op/op.ClearClipboard.php b/op/op.ClearClipboard.php
index b5d54db28..fb955afa6 100644
--- a/op/op.ClearClipboard.php
+++ b/op/op.ClearClipboard.php
@@ -2,7 +2,7 @@
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
-// Copyright (C) 2009-2013 Uwe Steinmann
+// Copyright (C) 2010-2016 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/op/op.CreateDump.php b/op/op.CreateDump.php
index 6b38f8ed7..ab79cb182 100644
--- a/op/op.CreateDump.php
+++ b/op/op.CreateDump.php
@@ -1,6 +1,7 @@
isAdmin()) {
}
$v = new SeedDMS_Version;
-$dump_name = $settings->_contentDir.date('Y-m-d\TH:i:s')."_".$v->_number.".sql";
+$dump_name = $settings->_contentDir.date('Y-m-d\TH-i-s')."_".$v->_number.".sql";
if(!$dms->createDump($dump_name))
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
diff --git a/op/op.CreateFolderArchive.php b/op/op.CreateFolderArchive.php
index 5615e2ac7..0bc9d4ca9 100644
--- a/op/op.CreateFolderArchive.php
+++ b/op/op.CreateFolderArchive.php
@@ -1,6 +1,7 @@
_rootDir . "languages/" . $settings->_language . "/lang.inc";
-function _printMessage($heading, $message) {
+function _printMessage($heading, $message) { /* {{{ */
global $dms, $theme;
$view = UI::factory($theme, 'ErrorDlg', array('dms'=>$dms));
$view->exitError($heading, $message, true);
return;
-}
+} /* }}} */
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$controller = Controller::factory($tmp[1]);
@@ -62,6 +63,7 @@ if(isset($_POST['pwd'])) {
}
}
+/* The password may only be empty if the guest user tries to log in */
if($settings->_enableGuestLogin && (int) $settings->_guestID) {
$guestUser = $dms->getUser((int) $settings->_guestID);
if ((!isset($pwd) || strlen($pwd)==0) && ($login != $guestUser->getLogin())) {
@@ -86,152 +88,46 @@ if(isset($GLOBALS['SEEDDMS_HOOKS']['authentication'])) {
}
}
-if (is_bool($user)) {
-if (isset($settings->_ldapHost) && strlen($settings->_ldapHost)>0) {
- if (isset($settings->_ldapPort) && is_int($settings->_ldapPort)) {
- $ds = ldap_connect($settings->_ldapHost, $settings->_ldapPort);
- } else {
- $ds = ldap_connect($settings->_ldapHost);
- }
+/* Authenticate against LDAP server {{{ */
+if (!$user && isset($settings->_ldapHost) && strlen($settings->_ldapHost)>0) {
+ require_once("../inc/inc.ClassLdapAuthentication.php");
+ $authobj = new SeedDMS_LdapAuthentication($dms, $settings);
+ $user = $authobj->authenticate($login, $pwd);
+} /* }}} */
- if (!is_bool($ds)) {
- /* Check if ldap base dn is set, and use ldap server if it is */
- if (isset($settings->_ldapBaseDN)) {
- $ldapSearchAttribut = "uid=";
- $tmpDN = "uid=".$login.",".$settings->_ldapBaseDN;
- }
+/* Authenticate against SeedDMS database {{{ */
+else {
+ require_once("../inc/inc.ClassDbAuthentication.php");
+ $authobj = new SeedDMS_DbAuthentication($dms, $settings);
+ $user = $authobj->authenticate($login, $pwd);
+} /* }}} */
- /* Active directory has a different base dn */
- if (isset($settings->_ldapType)) {
- if ($settings->_ldapType==1) {
- $ldapSearchAttribut = "sAMAccountName=";
- $tmpDN = $login.'@'.$settings->_ldapAccountDomainName;
- // Add the following if authentication with an Active Dir doesn't work
- // See https://sourceforge.net/p/seeddms/discussion/general/thread/19c70d8d/
- // and http://stackoverflow.com/questions/6222641/how-to-php-ldap-search-to-get-user-ou-if-i-dont-know-the-ou-for-base-dn
- ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
- }
- }
-
- // Ensure that the LDAP connection is set to use version 3 protocol.
- // Required for most authentication methods, including SASL.
- ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
-
- // try an authenticated/anonymous bind first.
- // If it succeeds, get the DN for the user and use it for an authentication
- // with the users password.
- $bind = false;
- if (isset($settings->_ldapBindDN)) {
- $bind = @ldap_bind($ds, $settings->_ldapBindDN, $settings->_ldapBindPw);
- } else {
- $bind = @ldap_bind($ds);
- }
- $dn = false;
- /* If bind succeed, then get the dn of for the user */
- if ($bind) {
- if (isset($settings->_ldapFilter) && strlen($settings->_ldapFilter) > 0) {
- $search = ldap_search($ds, $settings->_ldapBaseDN, "(&(".$ldapSearchAttribut.$login.")".$settings->_ldapFilter.")");
- } else {
- $search = ldap_search($ds, $settings->_ldapBaseDN, $ldapSearchAttribut.$login);
- }
- if (!is_bool($search)) {
- $info = ldap_get_entries($ds, $search);
- if (!is_bool($info) && $info["count"]>0) {
- $dn = $info[0]['dn'];
- }
- }
- }
-
- /* If the previous bind failed, try it with the users creditionals
- * by simply setting $dn to a default string
- */
- if (is_bool($dn)) {
- $dn = $tmpDN;
- }
-
- /* No do the actual authentication of the user */
- $bind = @ldap_bind($ds, $dn, $pwd);
- if ($bind) {
- // Successfully authenticated. Now check to see if the user exists within
- // the database. If not, add them in if _restricted is not set,
- // but do not add their password.
- $user = $dms->getUserByLogin($login);
- if (is_bool($user) && !$settings->_restricted) {
- // Retrieve the user's LDAP information.
- if (isset($settings->_ldapFilter) && strlen($settings->_ldapFilter) > 0) {
- $search = ldap_search($ds, $settings->_ldapBaseDN, "(&(".$ldapSearchAttribut.$login.")".$settings->_ldapFilter.")");
- } else {
- $search = ldap_search($ds, $settings->_ldapBaseDN, $ldapSearchAttribut.$login);
- }
-
- if (!is_bool($search)) {
- $info = ldap_get_entries($ds, $search);
- if (!is_bool($info) && $info["count"]==1 && $info[0]["count"]>0) {
- $user = $dms->addUser($login, null, $info[0]['cn'][0], $info[0]['mail'][0], $settings->_language, $settings->_theme, "");
- }
- }
- }
- if (!is_bool($user)) {
- $userid = $user->getID();
- }
- }
- ldap_close($ds);
- }
-}
+if(!$user) {
+ _printMessage(getMLText("login_error_title"), getMLText("login_error_text"));
+ exit;
}
-if (is_bool($user)) {
- //
- // LDAP Authentication did not succeed or is not configured. Try internal
- // authentication system.
- //
-
- // Try to find user with given login.
- $user = $dms->getUserByLogin($login);
- if (!$user) {
- _printMessage(getMLText("login_error_title"), getMLText("login_error_text"));
- exit;
- }
-
- $userid = $user->getID();
-
- if (($userid == $settings->_guestID) && (!$settings->_enableGuestLogin)) {
- _printMessage(getMLText("login_error_title"), getMLText("guest_login_disabled"));
- exit;
- }
-
- // Check if password matches (if not a guest user)
- // Assume that the password has been sent via HTTP POST. It would be careless
- // (and dangerous) for passwords to be sent via GET.
- if (($userid != $settings->_guestID) && (md5($pwd) != $user->getPwd()) || ($userid == $settings->_guestID) && $user->getPwd() && (md5($pwd) != $user->getPwd())) {
- _printMessage(getMLText("login_error_title"), getMLText("login_error_text"));
- /* if counting of login failures is turned on, then increment its value */
- if($settings->_loginFailure) {
- $failures = $user->addLoginFailure();
- if($failures >= $settings->_loginFailure)
- $user->setDisabled(true);
- }
- exit;
- }
-
- // Check if account is disabled
- if($user->isDisabled()) {
- _printMessage(getMLText("login_disabled_title"), getMLText("login_disabled_text"));
- exit;
- }
-
- // control admin IP address if required
- // TODO: extend control to LDAP autentication
- if ($user->isAdmin() && ($_SERVER['REMOTE_ADDR'] != $settings->_adminIP ) && ( $settings->_adminIP != "") ){
- _printMessage(getMLText("login_error_title"), getMLText("invalid_user_id"));
- exit;
- }
-
- /* Clear login failures if login was successful */
- $user->clearLoginFailures();
-
+$userid = $user->getID();
+if (($userid == $settings->_guestID) && (!$settings->_enableGuestLogin)) {
+ _printMessage(getMLText("login_error_title"), getMLText("guest_login_disabled"));
+ exit;
}
+// Check if account is disabled
+if($user->isDisabled()) {
+ _printMessage(getMLText("login_disabled_title"), getMLText("login_disabled_text"));
+ exit;
+}
+
+// control admin IP address if required
+if ($user->isAdmin() && ($_SERVER['REMOTE_ADDR'] != $settings->_adminIP ) && ( $settings->_adminIP != "") ){
+ _printMessage(getMLText("login_error_title"), getMLText("invalid_user_id"));
+ exit;
+}
+
+/* Clear login failures if login was successful */
+$user->clearLoginFailures();
+
// Capture the user's language and theme settings.
if (isset($_REQUEST["lang"]) && strlen($_REQUEST["lang"])>0 && is_numeric(array_search($_REQUEST["lang"],getLanguages())) ) {
$lang = $_REQUEST["lang"];
@@ -326,7 +222,4 @@ 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)));
}
-//_printMessage(getMLText("login_ok"),
-// "".getMLText("continue")."
");
-
?>
diff --git a/op/op.Logout.php b/op/op.Logout.php
index 45ad43612..ce63730d7 100644
--- a/op/op.Logout.php
+++ b/op/op.Logout.php
@@ -2,7 +2,7 @@
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
-// Copyright (C) 2010 Uwe Steinmann
+// Copyright (C) 2010-2016 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/op/op.ManageNotify.php b/op/op.ManageNotify.php
index 7880f0f8d..0cfed8632 100644
--- a/op/op.ManageNotify.php
+++ b/op/op.ManageNotify.php
@@ -1,6 +1,7 @@
getContent())==1) {
if (!$document->remove()) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
} else {
+ /* Remove the document from the fulltext index */
+ if($settings->_enableFullSearch) {
+ $index = $indexconf['Indexer']::open($settings->_luceneDir);
+ if($index) {
+ $lucenesearch = new $indexconf['Search']($index);
+ if($hit = $lucenesearch->getDocument($documentid)) {
+ $index->delete($hit->id);
+ $index->commit();
+ }
+ }
+ }
+
if ($notifier){
$subject = "document_deleted_email_subject";
$message = "document_deleted_email_body";
@@ -117,6 +130,21 @@ else {
if (!$document->removeContent($version)) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
} else {
+ /* Remove the document from the fulltext index and reindex latest version */
+ if($settings->_enableFullSearch) {
+ $index = $indexconf['Indexer']::open($settings->_luceneDir);
+ if($index) {
+ $lucenesearch = new $indexconf['Search']($index);
+ if($hit = $lucenesearch->getDocument($document->getID())) {
+ $index->delete($hit->id);
+ }
+ $version = $document->getLatestContent();
+ $indexconf['Indexer']::init($settings->_stopWordsFile);
+ $index->addDocument(new $indexconf['IndexedDocument']($dms, $document, isset($settings->_converters['fulltext']) ? $settings->_converters['fulltext'] : null, !($version->getFileSize() < $settings->_maxSizeForFullText)));
+ $index->commit();
+ }
+ }
+
// Notify affected users.
if ($notifier){
$nl=$document->getNotifyList();
diff --git a/op/op.RemoveWorkflow.php b/op/op.RemoveWorkflow.php
index f1abeff15..2c961a79b 100644
--- a/op/op.RemoveWorkflow.php
+++ b/op/op.RemoveWorkflow.php
@@ -2,6 +2,7 @@
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
+// Copyright (C) 2010-2016 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/op/op.RemoveWorkflowAction.php b/op/op.RemoveWorkflowAction.php
index a6e4c5e4e..8934c403b 100644
--- a/op/op.RemoveWorkflowAction.php
+++ b/op/op.RemoveWorkflowAction.php
@@ -2,6 +2,7 @@
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
+// Copyright (C) 2010-2016 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/op/op.RemoveWorkflowFromDocument.php b/op/op.RemoveWorkflowFromDocument.php
index 6e63ee2e0..d3c2d027d 100644
--- a/op/op.RemoveWorkflowFromDocument.php
+++ b/op/op.RemoveWorkflowFromDocument.php
@@ -2,6 +2,7 @@
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
+// Copyright (C) 2010-2016 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/op/op.RemoveWorkflowState.php b/op/op.RemoveWorkflowState.php
index 4d27072a9..3298dde03 100644
--- a/op/op.RemoveWorkflowState.php
+++ b/op/op.RemoveWorkflowState.php
@@ -2,6 +2,7 @@
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
+// Copyright (C) 2010-2016 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/op/op.ResetSu.php b/op/op.ResetSu.php
index b3b8b877e..a8898cb8d 100644
--- a/op/op.ResetSu.php
+++ b/op/op.ResetSu.php
@@ -1,6 +1,6 @@
getFolder();
// Retrieve a list of all users and groups that have review / approve
// privileges.
-$docAccess = $document->getReadAccessList();
+$docAccess = $document->getReadAccessList($settings->_enableAdminRevApp, $settings->_enableOwnerRevApp);
$accessIndex = array("i"=>array(), "g"=>array());
foreach ($docAccess["users"] as $i=>$da) {
$accessIndex["i"][$da->getID()] = $i;
diff --git a/op/op.SetWorkflow.php b/op/op.SetWorkflow.php
index cf7e686b0..0a5e09c42 100644
--- a/op/op.SetWorkflow.php
+++ b/op/op.SetWorkflow.php
@@ -3,6 +3,7 @@
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
// Copyright (C) 2010 Matteo Lucarelli
+// Copyright (C) 2010-2016 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/op/op.Settings.php b/op/op.Settings.php
index 08f02fc4a..ab99468ae 100644
--- a/op/op.Settings.php
+++ b/op/op.Settings.php
@@ -3,6 +3,7 @@
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
// Copyright (C) 2010 Matteo Lucarelli
+// Copyright (C) 2010-2016 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -70,8 +71,9 @@ if ($action == "saveSettings")
$settings->_enableEmail =getBoolValue("enableEmail");
$settings->_enableUsersView = getBoolValue("enableUsersView");
$settings->_enableFullSearch = getBoolValue("enableFullSearch");
- $settings->_fullSearchEngine = $_POST["fullSearchEngine"];
- $settings->_defaultSearchMethod = $_POST["defaultSearchMethod"];
+ $settings->_maxSizeForFullText = intval($_POST["maxSizeForFullText"]);
+ $settings->_fullSearchEngine = $_POST["fullSearchEngine"];
+ $settings->_defaultSearchMethod = $_POST["defaultSearchMethod"];
$settings->_enableClipboard = getBoolValue("enableClipboard");
$settings->_enableDropUpload = getBoolValue("enableDropUpload");
$settings->_enableFolderTree = getBoolValue("enableFolderTree");
@@ -81,9 +83,9 @@ if ($action == "saveSettings")
$settings->_enableHelp = getBoolValue("enableHelp");
$settings->_enableThemeSelector = getBoolValue("enableThemeSelector");
$settings->_expandFolderTree = intval($_POST["expandFolderTree"]);
- $settings->_stopWordsFile = $_POST["stopWordsFile"];
- $settings->_sortUsersInList = $_POST["sortUsersInList"];
- $settings->_sortFoldersDefault = $_POST["sortFoldersDefault"];
+ $settings->_stopWordsFile = $_POST["stopWordsFile"];
+ $settings->_sortUsersInList = $_POST["sortUsersInList"];
+ $settings->_sortFoldersDefault = $_POST["sortFoldersDefault"];
// SETTINGS - SITE - CALENDAR
$settings->_enableCalendar = getBoolValue("enableCalendar");
diff --git a/op/op.SubstituteUser.php b/op/op.SubstituteUser.php
index 9e366de98..cb7b83bb7 100644
--- a/op/op.SubstituteUser.php
+++ b/op/op.SubstituteUser.php
@@ -1,6 +1,6 @@
addContent($comment, $user, $userfiletmp, basename($userfilename), $fileType, $userfiletype, $reviewers, $approvers, $version=0, $attributes, $workflow);
if (is_bool($contentResult) && !$contentResult) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
}
else {
+ if($settings->_enableFullSearch) {
+ $index = $indexconf['Indexer']::open($settings->_luceneDir);
+ if($index) {
+ $lucenesearch = new $indexconf['Search']($index);
+ if($hit = $lucenesearch->getDocument((int) $document->getId())) {
+ $index->delete($hit->id);
+ }
+ $indexconf['Indexer']::init($settings->_stopWordsFile);
+ $index->addDocument(new $indexconf['IndexedDocument']($dms, $document, isset($settings->_converters['fulltext']) ? $settings->_converters['fulltext'] : null, !($filesize < $settings->_maxSizeForFullText)));
+ $index->commit();
+ }
+ }
+
// Send notification to subscribers.
if ($notifier){
$notifyList = $document->getNotifyList();
diff --git a/op/op.UpdateDocument2.php b/op/op.UpdateDocument2.php
index df5c3addf..29229ba6b 100644
--- a/op/op.UpdateDocument2.php
+++ b/op/op.UpdateDocument2.php
@@ -2,6 +2,7 @@
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
+// Copyright (C) 2010-2016 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -152,34 +153,29 @@ if( move_uploaded_file( $source_file_path, $target_file_path ) ) {
}
}
-
+ $filesize = SeedDMS_Core_File::fileSize($userfiletmp);
$contentResult=$document->addContent($comment, $user, $userfiletmp, basename($userfilename), $fileType, $userfiletype, $reviewers, $approvers);
unlink($userfiletmp);
if (is_bool($contentResult) && !$contentResult) {
echo getMLText("error_occured");
} else {
+ if($settings->_enableFullSearch) {
+ $index = $indexconf['Indexer']::open($settings->_luceneDir);
+ if($index) {
+ $lucenesearch = new $indexconf['Search']($index);
+ if($hit = $lucenesearch->getDocument((int) $document->getId())) {
+ $index->delete($hit->id);
+ }
+ $indexconf['Indexer']::init($settings->_stopWordsFile);
+ $index->addDocument(new $indexconf['IndexedDocument']($dms, $document, isset($settings->_converters['fulltext']) ? $settings->_converters['fulltext'] : null, !($filesize < $settings->_maxSizeForFullText)));
+ $index->commit();
+ }
+ }
+
// Send notification to subscribers.
if ($notifier){
$notifyList = $document->getNotifyList();
$folder = $document->getFolder();
-/*
- $subject = "###SITENAME###: ".$document->getName()." - ".getMLText("document_updated_email");
- $message = getMLText("document_updated_email")."\r\n";
- $message .=
- getMLText("document").": ".$document->getName()."\r\n".
- getMLText("folder").": ".$folder->getFolderPathPlain()."\r\n".
- getMLText("comment").": ".$document->getComment()."\r\n".
- "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$document->getID()."\r\n";
-
- $notifier->toList($user, $document->_notifyList["users"], $subject, $message);
- foreach ($document->_notifyList["groups"] as $grp) {
- $notifier->toGroup($user, $grp, $subject, $message);
- }
-
- // if user is not owner send notification to owner
- if ($user->getID()!= $document->getOwner()->getID())
- $notifier->toIndividual($user, $document->getOwner(), $subject, $message);
-*/
$subject = "document_updated_email_subject";
$message = "document_updated_email_body";
$params = array();
@@ -207,20 +203,6 @@ if( move_uploaded_file( $source_file_path, $target_file_path ) ) {
$notifyList = $document->getNotifyList();
$folder = $document->getFolder();
// Send notification to subscribers.
-/*
- $subject = "###SITENAME###: ".$document->getName()." - ".getMLText("expiry_changed_email");
- $message = getMLText("expiry_changed_email")."\r\n";
- $message .=
- getMLText("document").": ".$document->getName()."\r\n".
- getMLText("folder").": ".$folder->getFolderPathPlain()."\r\n".
- getMLText("comment").": ".$document->getComment()."\r\n".
- "URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$document->getID()."\r\n";
-
- $notifier->toList($user, $document->_notifyList["users"], $subject, $message);
- foreach ($document->_notifyList["groups"] as $grp) {
- $notifier->toGroup($user, $grp, $subject, $message);
- }
-*/
$subject = "expiry_changed_email_subject";
$message = "expiry_changed_email_body";
$params = array();
diff --git a/op/op.UserDefaultKeywords.php b/op/op.UserDefaultKeywords.php
index 2bb860b5e..5fe1c1465 100644
--- a/op/op.UserDefaultKeywords.php
+++ b/op/op.UserDefaultKeywords.php
@@ -2,6 +2,7 @@
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
+// Copyright (C) 2010-2016 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/op/op.UsrMgr.php b/op/op.UsrMgr.php
index 505d34d3c..bed9dac88 100644
--- a/op/op.UsrMgr.php
+++ b/op/op.UsrMgr.php
@@ -3,7 +3,7 @@
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
// Copyright (C) 2010 Matteo Lucarelli
-// Copyright (C) 2010-2012 Uwe Steinmann
+// Copyright (C) 2010-2016 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/op/op.ViewOnline.php b/op/op.ViewOnline.php
index f0cae78af..13b0c2c90 100644
--- a/op/op.ViewOnline.php
+++ b/op/op.ViewOnline.php
@@ -2,7 +2,7 @@
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
-// Copyright (C) 2011 Uwe Steinmann
+// Copyright (C) 2010-2016 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/op/op.WorkflowActionsMgr.php b/op/op.WorkflowActionsMgr.php
index 5bdada4c8..f683468e9 100644
--- a/op/op.WorkflowActionsMgr.php
+++ b/op/op.WorkflowActionsMgr.php
@@ -3,7 +3,7 @@
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
// Copyright (C) 2010 Matteo Lucarelli
-// Copyright (C) 2010-2013 Uwe Steinmann
+// Copyright (C) 2010-2016 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/op/op.WorkflowMgr.php b/op/op.WorkflowMgr.php
index cab683a7f..c7a239a6c 100644
--- a/op/op.WorkflowMgr.php
+++ b/op/op.WorkflowMgr.php
@@ -3,7 +3,7 @@
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
// Copyright (C) 2010 Matteo Lucarelli
-// Copyright (C) 2010-2013 Uwe Steinmann
+// Copyright (C) 2010-2016 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/op/op.WorkflowStatesMgr.php b/op/op.WorkflowStatesMgr.php
index 6d4488ae7..1b3464a76 100644
--- a/op/op.WorkflowStatesMgr.php
+++ b/op/op.WorkflowStatesMgr.php
@@ -3,7 +3,7 @@
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
// Copyright (C) 2010 Matteo Lucarelli
-// Copyright (C) 2010-2013 Uwe Steinmann
+// Copyright (C) 2010-2016 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
diff --git a/out/out.AddDocument.php b/out/out.AddDocument.php
index 2fe51fed4..d65cd360f 100644
--- a/out/out.AddDocument.php
+++ b/out/out.AddDocument.php
@@ -1,8 +1,9 @@
params['folder']) && $this->params['folder']->getAccessMode($this->params['user']) >= M_READWRITE) {
$content .= " params['folder']->getID()."&refferer=".urlencode($this->params['refferer'])."\">".getMLText("move_clipboard")."\n";
}
- $content .= " params['refferer'])."\">".getMLText("clear_clipboard")."\n";
+// $content .= " params['refferer'])."\">".getMLText("clear_clipboard")."kkk \n";
+ $content .= " ".getMLText("clear_clipboard")."\n";
$content .= " \n";
$content .= " \n";
$content .= " \n";
@@ -1003,22 +1004,22 @@ function folderSelected(id, name) {
-function folderSelected(id, name) {
- $('#targetid').val(id);
- $('#choosefoldersearch').val(name);
- $('#folderChooser').modal('hide');
+function folderSelected(id, name) {
+ $('#targetid').val(id);
+ $('#choosefoldersearch').val(name);
+ $('#folderChooser').modal('hide');
}
printFolderChooserHtml($formName, $accessMode, $exclude, $default);
+ function printFolderChooser($form, $accessMode, $exclude = -1, $default = false, $formname='') { /* {{{ */
+ $this->printFolderChooserHtml($form, $accessMode, $exclude, $default, $formname);
?>
params['dms'];
$user = $this->params['user'];
- $showtree = $this->params['showtree'];
$workflowmode = $this->params['workflowmode'];
$previewwidth = $this->params['previewWidthList'];
$enableClipboard = $this->params['enableclipboard'];
@@ -1818,7 +1818,7 @@ $(document).ready( function() {
$content .= "";
$content .= "" . htmlspecialchars($document->getName()) . "";
- $content .= " ".getMLText('owner').": ".htmlspecialchars($owner->getFullName()).", ".getMLText('creation_date').": ".date('Y-m-d', $document->getDate()).", ".getMLText('version')." ".$version." - ".date('Y-m-d', $latestContent->getDate())."";
+ $content .= " ".getMLText('owner').": ".htmlspecialchars($owner->getFullName()).", ".getMLText('creation_date').": ".date('Y-m-d', $document->getDate()).", ".getMLText('version')." ".$version." - ".date('Y-m-d', $latestContent->getDate())."".($document->expires() ? ", ".getMLText('expires').": ".getReadableDate($document->getExpires())."" : "")."";
if($comment) {
$content .= " ".htmlspecialchars($comment)."";
}
@@ -1880,10 +1880,6 @@ $(document).ready( function() {
$owner = $subFolder->getOwner();
$comment = $subFolder->getComment();
if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "...";
- $subsub = $subFolder->getSubFolders();
- $subsub = SeedDMS_Core_DMS::filterAccess($subsub, $user, M_READ);
- $subdoc = $subFolder->getDocuments();
- $subdoc = SeedDMS_Core_DMS::filterAccess($subdoc, $user, M_READ);
$content = '';
$content .= " | getID()."\" draggable=\"true\" rel=\"folder_".$subFolder->getID()."\" class=\"folder table-row-folder\" formtoken=\"".createFormKey('movefolder')."\">";
@@ -1913,6 +1909,14 @@ $(document).ready( function() {
$content .= (!$cc['folder_precise'] ? '~'.(round($cc['folder_count']/$rr)*$rr) : $cc['folder_count'])." ".getMLText("folders")."
".(!$cc['document_precise'] ? '~'.(round($cc['document_count']/$rr)*$rr) : $cc['document_count'])." ".getMLText("documents");
}
} else {
+ /* FIXME: the following is very inefficient for just getting the number of
+ * subfolders and documents. Making it more efficient is difficult, because
+ * the access rights need to be checked.
+ */
+ $subsub = $subFolder->getSubFolders();
+ $subsub = SeedDMS_Core_DMS::filterAccess($subsub, $user, M_READ);
+ $subdoc = $subFolder->getDocuments();
+ $subdoc = SeedDMS_Core_DMS::filterAccess($subdoc, $user, M_READ);
$content .= count($subsub)." ".getMLText("folders")."
".count($subdoc)." ".getMLText("documents");
}
$content .= "";
diff --git a/views/bootstrap/class.Charts.php b/views/bootstrap/class.Charts.php
index 47940caf6..3df870c39 100644
--- a/views/bootstrap/class.Charts.php
+++ b/views/bootstrap/class.Charts.php
@@ -53,10 +53,11 @@ if(in_array($type, array('docspermonth'))) {
?>
var data = [
$rec) {
- $key = mktime(12, 0, 0, substr($rec['key'], 5, 2), 1, substr($rec['key'], 0, 4)) * 1000;
- echo '["'.$rec['key'].'",'.$rec['total'].'],'."\n";
-// echo '['.$i.','.$rec['total'].'],'."\n";
+ if($data) {
+ foreach($data as $i=>$rec) {
+ $key = mktime(12, 0, 0, substr($rec['key'], 5, 2), 1, substr($rec['key'], 0, 4)) * 1000;
+ echo '["'.$rec['key'].'",'.$rec['total'].'],'."\n";
+ }
}
?>
];
@@ -94,8 +95,10 @@ if(in_array($type, array('docspermonth'))) {
?>
var data = [
];
@@ -131,8 +134,10 @@ if(in_array($type, array('docspermonth'))) {
?>
var data = [
];
diff --git a/views/bootstrap/class.GroupView.php b/views/bootstrap/class.GroupView.php
index 279fcdbe5..44b89fddf 100644
--- a/views/bootstrap/class.GroupView.php
+++ b/views/bootstrap/class.GroupView.php
@@ -60,6 +60,8 @@ $(document).ready( function() {
foreach ($allGroups as $group){
+ if(!$group->isMember($user) && !$user->isAdmin())
+ continue;
$members = $group->getUsers();
$managers = $group->getManagers();
$ismanager = false; /* set to true if current user is manager */
@@ -67,11 +69,9 @@ $(document).ready( function() {
echo "".htmlspecialchars($group->getName());
if($group->getComment())
echo " : ".htmlspecialchars($group->getComment());
- foreach($managers as $manager)
- if($manager->getId() == $user->getId()) {
- echo " : ".getMLText("manager_of_group");
- $ismanager = true;
- }
+ $ismanager = $group->isMember($user, 1);
+ if($ismanager)
+ echo " : ".getMLText("manager_of_group");
echo "";
echo "
+ ">
+ : |
+ showTextField("maxSizeForFullText", $settings->_maxSizeForFullText); ?> |
+
">
: |
@@ -707,7 +711,8 @@ if(!is_writeable($settings->_configFilePath)) {
}
?>
-
+contentContainerEnd(); ?>
+
_configFilePath)) {
diff --git a/views/bootstrap/class.UserList.php b/views/bootstrap/class.UserList.php
index 6d57fcf18..8873c0f09 100644
--- a/views/bootstrap/class.UserList.php
+++ b/views/bootstrap/class.UserList.php
@@ -56,7 +56,7 @@ class SeedDMS_View_UserList extends SeedDMS_Bootstrap_Style {
echo " |
";
echo "";
if ($currUser->hasImage())
- print " getId()."\">";
+ print " getId()."\">";
echo " | ";
echo "";
echo htmlspecialchars($currUser->getFullName())." (".htmlspecialchars($currUser->getLogin()).") ";
diff --git a/views/bootstrap/class.UsrView.php b/views/bootstrap/class.UsrView.php
index 1c7953c82..d091d5db4 100644
--- a/views/bootstrap/class.UsrView.php
+++ b/views/bootstrap/class.UsrView.php
@@ -46,36 +46,32 @@ class SeedDMS_View_UsrView extends SeedDMS_Bootstrap_Style {
$this->contentHeading(getMLText("users"));
$this->contentContainerStart();
- echo "\n";
+ echo "\n";
echo "\n\n";
+ if($enableuserimage) echo " | \n";
echo "".getMLText("name")." | \n";
- echo "".getMLText("email")." | \n";
- echo "".getMLText("comment")." | \n";
- if ($enableuserimage) echo "".getMLText("user_image")." | \n";
echo " \n\n";
foreach ($users as $currUser) {
if ($currUser->isGuest())
continue;
-
+
if ($currUser->isHidden()=="1") continue;
-
- echo "\n";
-
- print "".htmlspecialchars($currUser->getFullName())." | ";
-
- print "getEmail())."\">".htmlspecialchars($currUser->getEmail())." | ";
- print "".htmlspecialchars($currUser->getComment())." | ";
-
- if ($enableuserimage){
- print "";
- if ($currUser->hasImage()) print " getId()."\">";
- else printMLText("no_user_image");
- print " | ";
+
+ echo " ";
+ if($enableuserimage) {
+ echo "";
+ if ($currUser->hasImage())
+ print " getId()."\">";
+ echo " | ";
}
-
- echo " \n";
+ echo "";
+ echo htmlspecialchars($currUser->getFullName())." (".htmlspecialchars($currUser->getLogin()).") ";
+ echo "getEmail()."\">".htmlspecialchars($currUser->getEmail())." ";
+ echo "".htmlspecialchars($currUser->getComment())."";
+ echo " | ";
+ echo "";
}
echo " \n";
diff --git a/views/bootstrap/class.ViewDocument.php b/views/bootstrap/class.ViewDocument.php
index 02c0534e1..e27a3af5c 100644
--- a/views/bootstrap/class.ViewDocument.php
+++ b/views/bootstrap/class.ViewDocument.php
@@ -370,7 +370,6 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
foreach($attributes as $attribute) {
$arr = $this->callHook('showDocumentAttribute', $document, $attribute);
if(is_array($arr)) {
- echo $txt;
echo "";
echo "".$arr[0].": | ";
echo "".$arr[1]." | ";
|