mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-12 08:55:54 +00:00
show debug msg when test mail is send, use controller for RemoveDocument
This commit is contained in:
parent
4c3e7acdeb
commit
ff2a815b6c
|
@ -238,15 +238,19 @@ switch($command) {
|
||||||
if($user && $user->isAdmin()) {
|
if($user && $user->isAdmin()) {
|
||||||
if($user->getEmail()) {
|
if($user->getEmail()) {
|
||||||
$emailobj = new SeedDMS_EmailNotify($dms, $settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword);
|
$emailobj = new SeedDMS_EmailNotify($dms, $settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword);
|
||||||
|
$emailobj->setDebug(true);
|
||||||
$params = array();
|
$params = array();
|
||||||
|
|
||||||
if($emailobj->toIndividual($settings->_smtpSendFrom, $user, "testmail_subject", "testmail_body", $params)) {
|
ob_start();
|
||||||
echo json_encode(array("error"=>0, "msg"=>"Sending email succeded"));
|
$ret = $emailobj->toIndividual($settings->_smtpSendFrom, $user, "testmail_subject", "testmail_body", $params);
|
||||||
|
$debugoutput = ob_get_clean();
|
||||||
|
if($ret) {
|
||||||
|
echo json_encode(array("error"=>0, "msg"=>"Sending email succeded", "data"=>$debugoutput));
|
||||||
} else {
|
} else {
|
||||||
echo json_encode(array("error"=>1, "msg"=>"Sending email failed"));
|
echo json_encode(array("error"=>1, "msg"=>"Sending email failed", "data"=>$debugoutput));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo json_encode(array("error"=>1, "msg"=>"No email address"));
|
echo json_encode(array("error"=>1, "msg"=>"Your account has no email address set", "data"=>""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break; /* }}} */
|
break; /* }}} */
|
||||||
|
@ -407,19 +411,20 @@ switch($command) {
|
||||||
'groups'=>array_unique(array_merge($dnl['groups'], $fnl['groups']), SORT_REGULAR)
|
'groups'=>array_unique(array_merge($dnl['groups'], $fnl['groups']), SORT_REGULAR)
|
||||||
);
|
);
|
||||||
$docname = $document->getName();
|
$docname = $document->getName();
|
||||||
if($document->remove()) {
|
|
||||||
/* 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($_REQUEST['id'])) {
|
|
||||||
$index->delete($hit->id);
|
|
||||||
$index->commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if($settings->_enableFullSearch) {
|
||||||
|
$index = $indexconf['Indexer']::open($settings->_luceneDir);
|
||||||
|
$indexconf['Indexer']::init($settings->_stopWordsFile);
|
||||||
|
} else {
|
||||||
|
$index = null;
|
||||||
|
$indexconf = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$controller = Controller::factory('RemoveDocument', array('dms'=>$dms, 'user'=>$user));
|
||||||
|
$controller->setParam('document', $document);
|
||||||
|
$controller->setParam('index', $index);
|
||||||
|
$controller->setParam('indexconf', $indexconf);
|
||||||
|
if($controller->run()) {
|
||||||
if ($notifier){
|
if ($notifier){
|
||||||
$subject = "document_deleted_email_subject";
|
$subject = "document_deleted_email_subject";
|
||||||
$message = "document_deleted_email_body";
|
$message = "document_deleted_email_body";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user