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

This commit is contained in:
Uwe Steinmann 2018-03-09 13:11:11 +01:00
commit 953e94cd8e
19 changed files with 292 additions and 137 deletions

View File

@ -95,7 +95,7 @@
- mayApprove() and mayReview() require the status of the document to be
S_DRAFT_APP resp. S_DRAFT_REV
- add preview for webm videos (Closes #374)
- add support for apache mod_xsendfile, minor optimization of file download
- add support for apache mod_xsendfile, minor optimization of file download (see #382)
- animate button to download more objects in folder list when loading is active
- use converters for creating preview images as configured in settings (Closes #389)
- propperly check if user is already in database when doing ldap auth (Closes #388)
@ -106,6 +106,9 @@
- attribute values can be deleted from all folders, documents
- new settings to disallow upload of documents with just a reviewer in traditional
workflow mode
- webdav and various script use the controller framework instead of calling
SeedDMS_Core methods
- do not verify peer name and certificate when connecting to smtp server
--------------------------------------------------------------------------------
Changes in version 5.1.5

View File

@ -2590,7 +2590,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
if(isset($this->_dms->callbacks['onPreRemoveDocument'])) {
foreach($this->_dms->callbacks['onPreRemoveDocument'] as $callback) {
$ret = call_user_func($callback[0], $callback[1], $this);
if($ret === false)
if(is_bool($ret))
return $ret;
}
}

View File

@ -969,8 +969,8 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
$db = $this->_dms->getDB();
/* Check if 'onPreRemoveFolder' callback is set */
if(isset($this->_dms->callbacks['onPreRemoveFolder'])) {
foreach($this->_dms->callbacks['onPreRemoveFolder'] as $callback) {
if(isset($this->_dms->callbacks['onPreRemoveFromDatabaseFolder'])) {
foreach($this->_dms->callbacks['onPreRemoveFromDatabaseFolder'] as $callback) {
$ret = call_user_func($callback[0], $callback[1], $this);
if(is_bool($ret))
return $ret;
@ -1010,10 +1010,10 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
$db->commitTransaction();
/* Check if 'onPostRemoveFolder' callback is set */
if(isset($this->_dms->callbacks['onPostRemoveFolder'])) {
foreach($this->_dms->callbacks['onPostRemoveFolder'] as $callback) {
/** @noinspection PhpStatementHasEmptyBodyInspection */
if(!call_user_func($callback[0], $callback[1], $this->_id)) {
if(isset($this->_dms->callbacks['onPostRemoveFromDatabaseFolder'])) {
foreach($this->_dms->callbacks['onPostRemoveFromDatabaseFolder'] as $callback) {
/** @noinspection PhpStatementHasEmptyBodyInspection */
if(!call_user_func($callback[0], $callback[1], $this->_id)) {
}
}
}
@ -1037,6 +1037,15 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
return false;
}
/* Check if 'onPreRemoveFolder' callback is set */
if(isset($this->_dms->callbacks['onPreRemoveFolder'])) {
foreach($this->_dms->callbacks['onPreRemoveFolder'] as $callback) {
$ret = call_user_func($callback[0], $callback[1], $this);
if(is_bool($ret))
return $ret;
}
}
//Entfernen der Unterordner und Dateien
$res = $this->getSubFolders();
if (is_bool($res) && !$res) return false;
@ -1057,7 +1066,18 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
}
}
return $this->removeFromDatabase();
$ret = $this->removeFromDatabase();
if(!$ret)
return $ret;
/* Check if 'onPostRemoveFolder' callback is set */
if(isset($this->_dms->callbacks['onPostRemoveFolder'])) {
foreach($this->_dms->callbacks['onPostRemoveFolder'] as $callback) {
call_user_func($callback[0], $callback[1], $this);
}
}
return $ret;
} /* }}} */
/**

View File

@ -57,9 +57,10 @@ class SeedDMS_Preview_Previewer extends SeedDMS_Preview_Base {
return false;
$document = $object->getDocument();
$dms = $document->_dms;
$dir = $this->previewDir.'/'.$document->getDir();
switch(get_class($object)) {
case "SeedDMS_Core_DocumentContent":
case $dms->getClassname('documentcontent'):
$target = $dir.'p'.$object->getVersion().'-'.$width;
break;
case "SeedDMS_Core_DocumentFile":

View File

@ -11,10 +11,10 @@
<email>uwe@steinmann.cx</email>
<active>yes</active>
</lead>
<date>2018-01-18</date>
<date>2018-03-08</date>
<time>10:59:39</time>
<version>
<release>1.2.7</release>
<release>1.2.8</release>
<api>1.2.0</api>
</version>
<stability>
@ -23,9 +23,7 @@
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
add SeedDMS_Preview_Base::sendFile() as a replacement for readfile() which uses
mod_xsendfile if available
execWithTimeout() reads data from stderr and returns it together with stdout in array
preview is also created if SeedDMS_Core_DocumentContent has a child class
</notes>
<contents>
<dir baseinstalldir="SeedDMS" name="/">
@ -354,5 +352,23 @@ SeedDMS_Preview_Base::setConverters() overrides existing converters.
New method SeedDMS_Preview_Base::addConverters() merges new converters with old ones.
</notes>
</release>
<release>
<date>2018-01-18</date>
<time>10:59:39</time>
<version>
<release>1.2.7</release>
<api>1.2.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
add SeedDMS_Preview_Base::sendFile() as a replacement for readfile() which uses
mod_xsendfile if available
execWithTimeout() reads data from stderr and returns it together with stdout in array
</notes>
</release>
</changelog>
</package>

View File

@ -3,7 +3,17 @@ Notifications
Most changes made to documents or folders in SeedDMS can be monitored
by the users. Notifications are send by email if a user or group
has subscribed it.
has subscribed to it. Setting up email is often troublesome, if you
are not running SeedDMS on a Linux server with a running mail server.
In that case you do not have to fill out any of the email settings
except for the From address ('Send from' on the 'System' tab of the
configuration). Mail is send by PHP's mail() function. If the SMTP
host in the configuration is filled out, SeedDMS will use the PEAR
Mail package for delivering mail to the configured server. If you
also fill out the SMTP user, authentication with the SMTP server
will also be done. Some servers like smtp.gmail.com may still complain
about an invalid authentification. You should then check in your
google account if less secure apps are allowed.
The following notifications are send to all users and groups having
registered a notification for the event:

View File

@ -118,9 +118,13 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
}
if($this->smtp_user) {
$mail_params['auth'] = true;
// $mail_params['debug'] = true;
$mail_params['username'] = $this->smtp_user;
$mail_params['password'] = $this->smtp_password;
}
/* See ticket #384 */
$mail_params['socket_options'] = array('ssl' => array('verify_peer' => false, 'verify_peer_name' => false));
$mail = Mail::factory('smtp', $mail_params);
} else {
$mail = Mail::factory('mail', $mail_params);

View File

@ -19,7 +19,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// Translators: Admin (1284)
// Translators: Admin (1286)
$text = array(
'2_factor_auth' => '',
@ -282,7 +282,7 @@ URL: [url]',
'content' => 'المحتوى',
'continue' => 'استمرار',
'converter_new_cmd' => '',
'converter_new_mimetype' => '',
'converter_new_mimetype' => 'ﻥﻮﻋ ﺝﺪﻳﺩ ﻢﻧ ﺎﻟﻮﺛﺎﺌﻗ',
'copied_to_checkout_as' => '',
'create_download_link' => '',
'create_fulltext_index' => 'انشاء فهرس للنص الكامل',
@ -314,7 +314,7 @@ URL: [url]',
'documentcontent' => '',
'documents' => 'المستندات',
'documents_checked_out_by_you' => '',
'documents_expired' => '',
'documents_expired' => 'ﻮﺛﺎﺌﻗ ﻢﻨﺘﻬﻳﺓ',
'documents_in_process' => 'مستندات رهن المعالجة',
'documents_locked' => '',
'documents_locked_by_you' => 'المستندات محمية من التعديل بواسطتك',

View File

@ -19,7 +19,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// Translators: Admin (738), kreml (455)
// Translators: Admin (739), kreml (455)
$text = array(
'2_factor_auth' => '',
@ -1575,7 +1575,7 @@ URL: [url]',
'toggle_manager' => 'Přepnout správce',
'toggle_qrcode' => '',
'to_before_from' => 'Datum ukončení nesmí být před datem zahájení',
'transfer_document' => '',
'transfer_document' => 'Přenést dokument',
'transfer_no_read_access' => '',
'transfer_no_write_access' => '',
'transfer_objects' => '',

View File

@ -19,7 +19,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// Translators: Admin (231)
// Translators: Admin (251)
$text = array(
'2_factor_auth' => '',
@ -30,10 +30,10 @@ $text = array(
'access_control_is_off' => '',
'access_denied' => '',
'access_inheritance' => '',
'access_mode' => '',
'access_mode_all' => '',
'access_mode' => 'Είδος πρόσβασης',
'access_mode_all' => 'Πλήρης πρόσβαση',
'access_mode_none' => '',
'access_mode_read' => '',
'access_mode_read' => 'Δικαιώματα ανάγνωσης',
'access_mode_readwrite' => '',
'access_permission_changed_email' => '',
'access_permission_changed_email_body' => '',
@ -66,7 +66,7 @@ $text = array(
'add_revision' => '',
'add_role' => '',
'add_subfolder' => 'Νέος υποφάκελος',
'add_to_clipboard' => '',
'add_to_clipboard' => 'Προσθήκη στο πρόχειρο',
'add_to_transmittal' => '',
'add_transmittal' => '',
'add_user' => 'Νέος χρήστης',
@ -273,7 +273,7 @@ $text = array(
'create_fulltext_index' => '',
'create_fulltext_index_warning' => '',
'creation_date' => 'Δημιουργήθηκε',
'cs_CZ' => '',
'cs_CZ' => 'Τσέχικα',
'current_password' => '',
'current_quota' => '',
'current_state' => '',
@ -291,7 +291,7 @@ $text = array(
'details' => 'Λεπτομέρειες',
'details_version' => 'Λεπτομέρειες για την έκδοση: [version]',
'de_DE' => 'German/Γερμανικά',
'disclaimer' => '',
'disclaimer' => 'Διαβαθμισμένη περιοχή. Η πρόσβαση επιτρέπεται μόνο σε εξουσιοδοτημένο προσωπικό. Κάθε παράβαση διώκεται σύμφωνα με τους εθνικούς και διεθνής νόμους.',
'discspace' => '',
'docs_in_reception_no_access' => '',
'docs_in_revision_no_access' => '',
@ -382,7 +382,7 @@ $text = array(
'edit_default_keywords' => '',
'edit_document_access' => '',
'edit_document_notify' => '',
'edit_document_props' => '',
'edit_document_props' => 'Επεξεργασία εγγράφου',
'edit_event' => '',
'edit_existing_access' => '',
'edit_existing_attribute_groups' => '',
@ -507,8 +507,8 @@ $text = array(
'hours' => 'ώρες',
'hr_HR' => '',
'human_readable' => '',
'hu_HU' => '',
'id' => '',
'hu_HU' => 'Ουγγρικά',
'id' => 'ID',
'identical_version' => '',
'import' => '',
'importfs' => '',
@ -558,7 +558,7 @@ $text = array(
'in_workflow' => '',
'is_disabled' => '',
'is_hidden' => '',
'it_IT' => '',
'it_IT' => 'Ιταλικά',
'january' => 'Ιανουάριος',
'js_form_error' => '',
'js_form_errors' => '',
@ -588,7 +588,7 @@ $text = array(
'keywords' => 'Κλειδιά',
'keywords_loading' => 'Παρακαλούμε αναμείνατε. Φόρτωση λίστας λέξεων κλειδιών',
'keyword_exists' => 'Το κλειδί υπάρχει',
'ko_KR' => '',
'ko_KR' => 'Κορεάτικα',
'language' => 'Γλώσσα',
'lastaccess' => '',
'last_update' => 'Τελευταία Αναναίωση',
@ -606,7 +606,7 @@ $text = array(
'list_hooks' => '',
'local_file' => '',
'locked_by' => '',
'lock_document' => '',
'lock_document' => 'Κλείδωμα',
'lock_message' => '',
'lock_status' => 'Κατάσταση',
'login' => 'Είσοδος',
@ -687,7 +687,7 @@ URL: [url]',
'new_subfolder_email_subject' => '',
'new_user_image' => '',
'next_state' => '',
'nl_NL' => '',
'nl_NL' => 'Δανέζικα',
'no' => 'Όχι',
'notify_added_email' => '',
'notify_added_email_body' => '',
@ -901,7 +901,7 @@ URL: [url]',
'role_name' => '',
'role_type' => '',
'role_user' => 'Χρήστης',
'ro_RO' => '',
'ro_RO' => 'Ρουμάνικα',
'run_subworkflow' => '',
'run_subworkflow_email_body' => '',
'run_subworkflow_email_subject' => '',
@ -1300,7 +1300,7 @@ URL: [url]',
'sign_in' => 'Σύνδεση',
'sign_out' => 'Αποσύνδεση',
'sign_out_user' => 'Αποσύνδεση χρήστη',
'sk_SK' => '',
'sk_SK' => 'Σλοβάκικα',
'space_used_on_data_folder' => '',
'splash_added_to_clipboard' => '',
'splash_add_access' => '',
@ -1318,7 +1318,7 @@ URL: [url]',
'splash_document_checkedout' => '',
'splash_document_edited' => '',
'splash_document_indexed' => '',
'splash_document_locked' => '',
'splash_document_locked' => 'Κλειδωμένο έγγραφο',
'splash_document_unlocked' => '',
'splash_edit_access' => '',
'splash_edit_attribute' => '',
@ -1459,12 +1459,12 @@ URL: [url]',
'transmittal_size' => '',
'tree_loading' => '',
'trigger_workflow' => '',
'tr_TR' => '',
'tr_TR' => 'Τούρκικα',
'tuesday' => 'Τρίτη',
'tuesday_abbr' => '',
'type_of_hook' => '',
'type_to_search' => '',
'uk_UA' => '',
'uk_UA' => 'Ουκρανικά',
'under_folder' => '',
'unknown_attrdef' => '',
'unknown_command' => '',
@ -1559,7 +1559,7 @@ URL: [url]',
'x_more_objects' => '',
'year_view' => '',
'yes' => 'Ναι',
'zh_CN' => '',
'zh_TW' => '',
'zh_CN' => 'Κινέζικα (CN)',
'zh_TW' => 'Κινέζικα (TW)',
);
?>

View File

@ -19,7 +19,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// Translators: Admin (1079), jeromerobert (50), lonnnew (9), Oudiceval (650)
// Translators: Admin (1079), jeromerobert (50), lonnnew (9), Oudiceval (657)
$text = array(
'2_factor_auth' => 'Authentification forte',
@ -338,7 +338,7 @@ URL: [url]',
'documents_to_revise' => 'Documents en attente de votre révision',
'documents_user_draft' => 'Ébauches',
'documents_user_expiration' => 'Documents expirés',
'documents_user_needs_correction' => '',
'documents_user_needs_correction' => 'Documents nécessitant une correction',
'documents_user_no_reception' => 'Documents sans réception',
'documents_user_obsolete' => 'Documents obsolètes',
'documents_user_reception' => 'Documents en attente de réception',
@ -450,7 +450,7 @@ Le lien est valide jusquau [valid].
'edit_comment' => 'Modifier le commentaire',
'edit_default_keywords' => 'Modifier les mots-clés',
'edit_document_access' => 'Modifier les droits d\'accès',
'edit_document_notify' => 'Notifications de documents',
'edit_document_notify' => 'Notification de document',
'edit_document_props' => 'Modifier le document',
'edit_event' => 'Modifier l\'événement',
'edit_existing_access' => 'Modifier la liste des droits d\'accès',
@ -458,7 +458,7 @@ Le lien est valide jusquau [valid].
'edit_existing_notify' => 'Modifier les notifications',
'edit_folder_access' => 'Modifier les droits d\'accès',
'edit_folder_attrdefgrp' => 'Modifier les groupes dattributs',
'edit_folder_notify' => 'Liste de notification de dossiers',
'edit_folder_notify' => 'Notification de dossier',
'edit_folder_props' => 'Modifier le dossier',
'edit_group' => 'Modifier un groupe',
'edit_online' => 'Modification en ligne',
@ -587,7 +587,7 @@ URL: [url]',
'group_exists' => 'Ce groupe existe déjà.',
'group_info' => 'Informations du groupe',
'group_management' => 'Gestion des groupes',
'group_members' => 'Membres de groupes',
'group_members' => 'Membres du groupe',
'group_receipt_summary' => 'Vue densemble groupe réception',
'group_review_summary' => 'Vue densemble groupe vérification',
'guest_login' => 'Se connecter comme invité',
@ -810,7 +810,7 @@ URL: [url]',
'no_default_keywords' => 'Aucun mot-clé disponible',
'no_docs_checked_out' => '',
'no_docs_locked' => 'Aucun document verrouillé',
'no_docs_needs_correction' => '',
'no_docs_needs_correction' => 'Aucun document ne nécessite de correction',
'no_docs_rejected' => 'Aucun document rejeté.',
'no_docs_to_approve' => 'Aucun document ne nécessite actuellement une approbation',
'no_docs_to_look_at' => 'Aucun document à surveiller',

View File

@ -19,7 +19,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// Translators: Admin (745), gijsbertush (610), pepijn (45), reinoutdijkstra@hotmail.com (270)
// Translators: Admin (746), gijsbertush (610), pepijn (45), reinoutdijkstra@hotmail.com (270)
$text = array(
'2_factor_auth' => '2-factor-authenticatie',
@ -1125,7 +1125,7 @@ URL: [url]',
'select_one' => 'Selecteer een',
'select_user' => '',
'select_users' => 'Klik om gebruikers te selecteren',
'select_value' => '',
'select_value' => 'selecteer waarde',
'select_workflow' => 'Selecteer workflow',
'send_email' => 'Verstuur email',
'send_login_data' => 'Verstuur Login-data',

View File

@ -19,7 +19,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// Translators: Admin (972), flaviove (627), lfcristofoli (352)
// Translators: Admin (973), flaviove (627), lfcristofoli (352)
$text = array(
'2_factor_auth' => '',
@ -1706,7 +1706,7 @@ URL: [url]',
'workflow_summary' => 'Sumário de fluxo de trabalho',
'workflow_transition_without_user_group' => '',
'workflow_user_summary' => 'Sumário de usuário',
'x_more_objects' => '',
'x_more_objects' => 'mais itens',
'year_view' => 'Visualização Anual',
'yes' => 'Sim',
'zh_CN' => 'Chinês (CN)',

View File

@ -19,7 +19,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// Translators: Admin (1059), aydin (83)
// Translators: Admin (1064), aydin (83)
$text = array(
'2_factor_auth' => '',
@ -597,7 +597,7 @@ URL: [url]',
'index_error' => '',
'index_folder' => 'Klasörü indeksle',
'index_pending' => '',
'index_waiting' => '',
'index_waiting' => 'Bekliyor',
'individuals' => 'Bireysel',
'indivіduals_in_groups' => '',
'info_recipients_tab_not_released' => '',
@ -1090,7 +1090,7 @@ URL: [url]',
'select_one' => 'Birini seçiniz',
'select_user' => '',
'select_users' => 'Kullanıcı seçmek için tıklayın',
'select_value' => '',
'select_value' => 'Değeri seç',
'select_workflow' => 'İş akışı seç',
'send_email' => '',
'send_login_data' => '',
@ -1582,9 +1582,9 @@ URL: [url]',
'toggle_manager' => 'Değişim yönetimi',
'toggle_qrcode' => '',
'to_before_from' => 'Bitiş tarihi başlama tarihinden önce olamaz',
'transfer_document' => '',
'transfer_document' => 'Dokumanı gönder',
'transfer_no_read_access' => '',
'transfer_no_write_access' => '',
'transfer_no_write_access' => 'Kullanıcının klasör üzerinde yazma hakkı yok',
'transfer_objects' => '',
'transfer_objects_to_user' => '',
'transfer_to_user' => '',
@ -1710,7 +1710,7 @@ URL: [url]',
'workflow_summary' => 'İş akış özeti',
'workflow_transition_without_user_group' => '',
'workflow_user_summary' => 'Kullanıcı özeti',
'x_more_objects' => '',
'x_more_objects' => '[number] více objektů',
'year_view' => 'Yıllık Görünüm',
'yes' => 'Evet',
'zh_CN' => 'Çince',

View File

@ -22,7 +22,6 @@ include("../inc/inc.Utils.php");
include("../inc/inc.Language.php");
include("../inc/inc.Init.php");
include("../inc/inc.Extension.php");
include("../inc/inc.Init.php");
include("../inc/inc.DBInit.php");
include("../inc/inc.ClassNotificationService.php");
include("../inc/inc.ClassEmailNotify.php");

View File

@ -62,6 +62,7 @@ if($settings->_enableFullSearch) {
$indexconf['Indexer']::init($settings->_stopWordsFile);
} else {
$index = null;
$indexconf = null;
}
$folder = $document->getFolder();

View File

@ -1,5 +1,9 @@
<?php
include("../inc/inc.ClassSettings.php");
if(isset($_SERVER['SEEDDMS_HOME'])) {
ini_set('include_path', $_SERVER['SEEDDMS_HOME'].'/utils'. PATH_SEPARATOR .ini_get('include_path'));
} else {
ini_set('include_path', dirname($argv[0]). PATH_SEPARATOR .ini_get('include_path'));
}
function usage() { /* {{{ */
echo "Usage:\n";
@ -51,16 +55,10 @@ if(isset($options['v']) || isset($options['verѕion'])) {
/* Set alternative config file */
if(isset($options['config'])) {
$settings = new Settings($options['config']);
} else {
$settings = new Settings();
define('SEEDDMS_CONFIG_FILE', $options['config']);
}
if(isset($settings->_extraPath))
ini_set('include_path', $settings->_extraPath. PATH_SEPARATOR .ini_get('include_path'));
require_once("SeedDMS/Core.php");
/* Set parent folder */
if(isset($options['F'])) {
$folderid = (int) $options['F'];
} else {
@ -69,16 +67,19 @@ if(isset($options['F'])) {
exit(1);
}
/* Set comment of document */
$comment = '';
if(isset($options['c'])) {
$comment = $options['c'];
}
/* Set comment of version */
$version_comment = '';
if(isset($options['C'])) {
$version_comment = $options['C'];
}
/* Set keywords */
$keywords = '';
if(isset($options['k'])) {
$keywords = $options['k'];
@ -119,18 +120,15 @@ if(isset($options['V'])) {
if($reqversion<1)
$reqversion=1;
$db = new SeedDMS_Core_DatabaseAccess($settings->_dbDriver, $settings->_dbHostname, $settings->_dbUser, $settings->_dbPass, $settings->_dbDatabase);
$db->connect() or die ("Could not connect to db-server \"" . $settings->_dbHostname . "\"");
//$db->_conn->debug = 1;
include("../inc/inc.Settings.php");
include("../inc/inc.Init.php");
include("../inc/inc.Extension.php");
include("../inc/inc.DBInit.php");
include("../inc/inc.ClassNotificationService.php");
include("../inc/inc.ClassEmailNotify.php");
include("../inc/inc.ClassController.php");
$dms = new SeedDMS_Core_DMS($db, $settings->_contentDir.$settings->_contentOffsetDir);
if(!$dms->checkVersion()) {
echo "Database update needed.";
exit;
}
/* Parse categories */
/* Parse categories {{{ */
$categories = array();
if(isset($options['K'])) {
$categorynames = explode(',', $options['K']);
@ -142,9 +140,9 @@ if(isset($options['K'])) {
echo "Category '".$categoryname."' not found\n";
}
}
}
} /* }}} */
/* Parse document attributes. */
/* Parse document attributes. {{{ */
$document_attributes = array();
if (isset($options['a'])) {
$docattr = array();
@ -168,9 +166,9 @@ if (isset($options['a'])) {
}
$document_attributes[$attrdef->getID()] = $attrVal;
}
}
} /* }}} */
/* Parse version attributes. */
/* Parse version attributes. {{{ */
$version_attributes = array();
if (isset($options['A'])) {
$verattr = array();
@ -194,15 +192,9 @@ if (isset($options['A'])) {
}
$version_attributes[$attrdef->getID()] = $attrVal;
}
}
} /* }}} */
$dms->setRootFolderID($settings->_rootFolderID);
$dms->setMaxDirID($settings->_maxDirID);
$dms->setEnableConverting($settings->_enableConverting);
$dms->setViewOnlineFileTypes($settings->_viewOnlineFileTypes);
/* Create a global user object */
/* Create a global user object {{{ */
if($username) {
if(!($user = $dms->getUserByLogin($username))) {
echo "No such user '".$username."'.";
@ -211,6 +203,34 @@ if($username) {
} else
$user = $dms->getUser(1);
$dms->setUser($user);
/* }}} */
/* Create a global notifier object {{{ */
$notifier = new SeedDMS_NotificationService();
if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) {
if(method_exists($notificationObj, 'preAddService')) {
$notificationObj->preAddService($dms, $notifier);
}
}
}
if($settings->_enableEmail) {
$notifier->addService(new SeedDMS_EmailNotify($dms, $settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword));
}
if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) {
if(method_exists($notificationObj, 'postAddService')) {
$notificationObj->postAddService($dms, $notifier);
}
}
}
/* }}} */
/* Check if file is readable {{{ */
if(is_readable($filename)) {
if(filesize($filename)) {
$finfo = new finfo(FILEINFO_MIME_TYPE);
@ -226,6 +246,7 @@ if(is_readable($filename)) {
echo "File is not readable\n";
exit(1);
}
/* }}} */
$folder = $dms->getFolder($folderid);
@ -244,7 +265,6 @@ if (!is_numeric($sequence)) {
exit(1);
}
//$expires = ($_POST["expires"] == "true") ? mktime(0,0,0, sanitizeString($_POST["expmonth"]), sanitizeString($_POST["expday"]), sanitizeString($_POST["expyear"])) : false;
$expires = false;
if(!$name)
@ -254,13 +274,47 @@ $filetmp = $filename;
$reviewers = array();
$approvers = array();
$res = $folder->addDocument($name, $comment, $expires, $user, $keywords,
$categories, $filetmp, basename($filename),
$filetype, $mimetype, $sequence, $reviewers,
$approvers, $reqversion, $version_comment,
$document_attributes, $version_attributes);
if($settings->_enableFullSearch) {
$index = $indexconf['Indexer']::open($settings->_luceneDir);
$indexconf['Indexer']::init($settings->_stopWordsFile);
} else {
$index = null;
$indexconf = null;
}
if (is_bool($res) && !$res) {
$controller = Controller::factory('AddDocument');
$controller->setParam('documentsource', 'script');
$controller->setParam('folder', $folder);
$controller->setParam('index', $index);
$controller->setParam('indexconf', $indexconf);
$controller->setParam('name', $name);
$controller->setParam('comment', $comment);
$controller->setParam('expires', $expires);
$controller->setParam('keywords', $keywords);
$controller->setParam('categories', $categories);
$controller->setParam('owner', $user);
$controller->setParam('userfiletmp', $filetmp);
$controller->setParam('userfilename', basename($filename));
$controller->setParam('filetype', $filetype);
$controller->setParam('userfiletype', $mimetype);
$minmax = $folder->getDocumentsMinMax();
if($settings->_defaultDocPosition == 'start')
$controller->setParam('sequence', $minmax['min'] - 1);
else
$controller->setParam('sequence', $minmax['max'] + 1);
$controller->setParam('reviewers', $reviewers);
$controller->setParam('approvers', $approvers);
$controller->setParam('reqversion', $reqversion);
$controller->setParam('versioncomment', $version_comment);
$controller->setParam('attributes', $document_attributes);
$controller->setParam('attributesversion', $version_attributes);
$controller->setParam('workflow', null);
$controller->setParam('notificationgroups', array());
$controller->setParam('notificationusers', array());
$controller->setParam('maxsizeforfulltext', $settings->_maxSizeForFullText);
$controller->setParam('defaultaccessdocs', $settings->_defaultAccessDocs);
if(!$document = $controller->run()) {
echo "Could not add document to folder\n";
exit(1);
}

View File

@ -1,13 +1,12 @@
<?php
include("../inc/inc.Settings.php");
include("../inc/inc.Init.php");
include("../inc/inc.Extension.php");
include("../inc/inc.DBInit.php");
include("../inc/inc.ClassNotificationService.php");
include("../inc/inc.ClassEmailNotify.php");
include("../inc/inc.ClassController.php");
include("Log.php");
include("webdav.php");
$db = new SeedDMS_Core_DatabaseAccess($settings->_dbDriver, $settings->_dbHostname, $settings->_dbUser, $settings->_dbPass, $settings->_dbDatabase);
$db->connect() or die ("Could not connect to db-server \"" . $settings->_dbHostname . "\"");
$db->getResult("set names 'utf8'");
$dms = new SeedDMS_Core_DMS($db, $settings->_contentDir.$settings->_contentOffsetDir);
if($settings->_logFileEnable) {
if ($settings->_logFileRotation=="h") $logname=date("YmdH", time());
@ -19,6 +18,7 @@ if($settings->_logFileEnable) {
$log = null;
}
include("webdav.php");
$server = new HTTP_WebDAV_Server_SeedDMS();
$server->ServeRequest($dms, $log);
//$files = array();

View File

@ -1,10 +1,6 @@
<?php
require_once "HTTP/WebDAV/Server.php";
if(!empty($settings->_coreDir))
require_once($settings->_coreDir.'/Core.php');
else
require_once('SeedDMS/Core.php');
/**
* SeedDMS access using WebDAV
@ -270,7 +266,7 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
$files["files"][] = $this->fileinfo($obj);
// information for contained resources requested?
if (get_class($obj) == 'SeedDMS_Core_Folder' && !empty($options["depth"])) {
if (get_class($obj) == $this->dms->getClassname('folder') && !empty($options["depth"])) {
$subfolders = $obj->getSubFolders();
$subfolders = SeedDMS_Core_DMS::filterAccess($subfolders, $this->user, M_READ);
@ -320,7 +316,7 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
$info["props"] = array();
// type and size (caller already made sure that path exists)
if (get_class($obj) == 'SeedDMS_Core_Folder') {
if (get_class($obj) == $this->dms->getClassname('folder')) {
// modification time
/* folders do not have a modification time */
$info["props"][] = $this->mkprop("getlastmodified", time());
@ -421,7 +417,7 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
if (!$obj) return false;
// is this a collection?
if (get_class($obj) == 'SeedDMS_Core_Folder') {
if (get_class($obj) == $this->dms->getClassname('folder')) {
return $this->GetDir($obj, $options);
}
@ -502,7 +498,7 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
foreach ($objs as $obj) {
$filename = $obj->getName();
$fullpath = $_fullpath.$filename;
if(get_class($obj) == 'SeedDMS_Core_Folder') {
if(get_class($obj) == $this->dms->getClassname('folder')) {
$fullpath .= '/';
$filename .= '/';
$filesize = 0;
@ -553,7 +549,7 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
$parent = '';
$folder = $this->reverseLookup($parent.'/');
if (!$folder || get_class($folder) != "SeedDMS_Core_Folder") {
if (!$folder || get_class($folder) != $this->dms->getClassname('folder')) {
return "409 Conflict";
}
@ -658,7 +654,7 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
}
/* Check if parent of new folder is a folder */
if (get_class($folder) != 'SeedDMS_Core_Folder') {
if (get_class($folder) != $this->dms->getClassname('folder')) {
return "403 Forbidden";
}
@ -696,6 +692,8 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
*/
function DELETE($options) /* {{{ */
{
global $settings, $indexconf;
$this->log_options('DELETE', $options);
// get folder or document from path
@ -712,7 +710,7 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
return "403 Forbidden";
}
if (get_class($obj) == 'SeedDMS_Core_Folder') {
if (get_class($obj) == $this->dms->getClassname('folder')) {
if($obj->hasDocuments() || $obj->hasSubFolders()) {
return "409 Conflict";
}
@ -720,15 +718,20 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
return "409 Conflict";
}
} else {
// check if user is admin
// only admins may delete documents
/* There is not reason to allow only admins to remove a document
if(!$this->user->isAdmin()) {
return "403 Forbidden";
if($settings->_enableFullSearch) {
$index = $indexconf['Indexer']::open($settings->_luceneDir);
$indexconf['Indexer']::init($settings->_stopWordsFile);
} else {
$index = null;
$indexconf = null;
}
*/
if(!$obj->remove()) {
$controller = Controller::factory('RemoveDocument');
$controller->setParam('document', $obj);
$controller->setParam('index', $index);
$controller->setParam('indexconf', $indexconf);
if(!$controller->run()) {
// if(!$obj->remove()) {
return "409 Conflict";
}
}
@ -782,12 +785,12 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
return "403 Forbidden";
}
if(get_class($objdest) == 'SeedDMS_Core_Document') {
if(get_class($objdest) == $this->dms->getClassname('document')) {
/* If destination object is a document it must be overwritten */
if (!$options["overwrite"]) {
return "412 precondition failed";
}
if(get_class($objsource) == 'SeedDMS_Core_Folder') {
if(get_class($objsource) == $this->dms->getClassname('folder')) {
return "400 Bad request";
}
@ -808,11 +811,11 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
$objsource->remove();
return "204 No Content";
} elseif(get_class($objdest) == 'SeedDMS_Core_Folder') {
} elseif(get_class($objdest) == $this->dms->getClassname('folder')) {
/* Set the new Folder of the source object */
if(get_class($objsource) == 'SeedDMS_Core_Document')
if(get_class($objsource) == $this->dms->getClassname('document'))
$objsource->setFolder($objdest);
elseif(get_class($objsource) == 'SeedDMS_Core_Folder')
elseif(get_class($objsource) == $this->dms->getClassname('folder'))
$objsource->setParent($objdest);
else
return "500 Internal server error";
@ -830,6 +833,8 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
*/
function COPY($options, $del=false) /* {{{ */
{
global $settings, $indexconf;
if(!$del)
$this->log_options('COPY', $options);
@ -852,7 +857,7 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
if (!$objsource)
return "404 Not found";
if (get_class($objsource) == 'SeedDMS_Core_Folder' && ($options["depth"] != "infinity")) {
if (get_class($objsource) == $this->dms->getClassname('folder') && ($options["depth"] != "infinity")) {
// RFC 2518 Section 9.2, last paragraph
return "400 Bad request";
}
@ -880,12 +885,12 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
}
/* If destination object is a document it must be overwritten */
if(get_class($objdest) == 'SeedDMS_Core_Document') {
if(get_class($objdest) == $this->dms->getClassname('document')) {
if (!$options["overwrite"]) {
return "412 precondition failed";
}
/* Copying a folder into a document makes no sense */
if(get_class($objsource) == 'SeedDMS_Core_Folder') {
if(get_class($objsource) == $this->dms->getClassname('folder')) {
return "400 Bad request";
}
@ -902,12 +907,12 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
$objdest->setName($objsource->getName());
return "204 No Content";
} elseif(get_class($objdest) == 'SeedDMS_Core_Folder') {
} elseif(get_class($objdest) == $this->dms->getClassname('folder')) {
if($this->logger)
$this->logger->log('COPY: copy \''.$objdest->getName().'\' to folder '.$objdest->getName().'', PEAR_LOG_INFO);
/* Currently no support for copying folders */
if(get_class($objsource) == 'SeedDMS_Core_Folder') {
if(get_class($objsource) == $this->dms->getClassname('folder')) {
if($this->logger)
$this->logger->log('COPY: source is a folder '.$objsource->getName().'', PEAR_LOG_INFO);
@ -921,7 +926,49 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
$content = $objsource->getLatestContent();
$fspath = $this->dms->contentDir.'/'.$content->getPath();
if(!$newdoc = $objdest->addDocument($newdocname, '', 0, $this->user, '', array(), $fspath, $content->getOriginalFileName(), $content->getFileType(), $content->getMimeType(), 0, array(), array(), 0, "")) {
if($settings->_enableFullSearch) {
$index = $indexconf['Indexer']::open($settings->_luceneDir);
$indexconf['Indexer']::init($settings->_stopWordsFile);
} else {
$index = null;
$indexconf = null;
}
$controller = Controller::factory('AddDocument');
$controller->setParam('documentsource', 'webdav');
$controller->setParam('folder', $objdest);
$controller->setParam('index', $index);
$controller->setParam('indexconf', $indexconf);
$controller->setParam('name', $newdocname);
$controller->setParam('comment', '');
$controller->setParam('expires', 0);
$controller->setParam('keywords', '');
$controller->setParam('categories', array());
$controller->setParam('owner', $this->user);
$controller->setParam('userfiletmp', $fspath);
$controller->setParam('userfilename', $content->getOriginalFileName());
$controller->setParam('filetype', $content->getFileType());
$controller->setParam('userfiletype', $content->getMimeType());
$minmax = $objdest->getDocumentsMinMax();
if($settings->_defaultDocPosition == 'start')
$controller->setParam('sequence', $minmax['min'] - 1);
else
$controller->setParam('sequence', $minmax['max'] + 1);
$controller->setParam('reviewers', array());
$controller->setParam('approvers', array());
$controller->setParam('reqversion', 0);
$controller->setParam('versioncomment', '');
$controller->setParam('attributes', array());
$controller->setParam('attributesversion', array());
$controller->setParam('workflow', null);
$controller->setParam('notificationgroups', array());
$controller->setParam('notificationusers', array());
$controller->setParam('maxsizeforfulltext', $settings->_maxSizeForFullText);
$controller->setParam('defaultaccessdocs', $settings->_defaultAccessDocs);
if(!$document = $controller->run()) {
// if(!$newdoc = $objdest->addDocument($newdocname, '', 0, $this->user, '', array(), $fspath, $content->getOriginalFileName(), $content->getFileType(), $content->getMimeType(), 0, array(), array(), 0, "")) {
if($this->logger)
$this->logger->log('COPY: error copying object', PEAR_LOG_INFO);
return "409 Conflict";
@ -1016,7 +1063,7 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
return "200 OK";
// TODO recursive locks on directories not supported yet
if (get_class($obj) == 'SeedDMS_Core_Folder' && !empty($options["depth"])) {
if (get_class($obj) == $this->dms->getClassname('folder') && !empty($options["depth"])) {
return "409 Conflict";
}
@ -1054,7 +1101,7 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
return "204 No Content";
// TODO recursive locks on directories not supported yet
if (get_class($obj) == 'SeedDMS_Core_Folder' && !empty($options["depth"])) {
if (get_class($obj) == $this->dms->getClassname('folder') && !empty($options["depth"])) {
return "409 Conflict";
}
@ -1091,7 +1138,7 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
}
// Folders cannot be locked
if(get_class($obj) == 'SeedDMS_Core_Folder') {
if(get_class($obj) == $this->dms->getClassname('folder')) {
if($this->logger)
$this->logger->log('checkLock: object is a folder', PEAR_LOG_INFO);
return false;