diff --git a/docs/kt-phpdoc.ini b/docs/kt-phpdoc.ini index 69a8493..efbae1a 100644 --- a/docs/kt-phpdoc.ini +++ b/docs/kt-phpdoc.ini @@ -95,7 +95,9 @@ ignore = thirdparty/ ;; HTML:Smarty:default,HTML:Smarty:PHP,HTML:Smarty:HandS ;; PDF:default:default,CHM:default:default,XML:DocBook/peardoc2:default ;output=HTML:frames:earthli,HTML:frames:default,HTML:frames:l0l33t,HTML:frames:phpdoc.de,HTML:frames:phphtmllib,HTML:frames:DOM/default,HTML:frames:DOM/l0l33t,HTML:frames:DOM/phpdoc.de,HTML:frames:DOM/earthli,HTML:frames:DOM/phphtmllib,HTML:frames:phpedit,HTML:Smarty:default,HTML:Smarty:PHP,HTML:Smarty:HandS -output=HTML:frames:DOM/earthli +;output=HTML:frames:earthli,HTML:frames:default,HTML:frames:l0l33t,HTML:frames:phpdoc.de,HTML:frames:phphtmllib,HTML:frames:DOM/default,HTML:frames:DOM/l0l33t,HTML:frames:DOM/phpdoc.de,HTML:frames:DOM/earthli,HTML:frames:DOM/phphtmllib,HTML:frames:phpedit,HTML:Smarty:default,HTML:Smarty:PHP,HTML:Smarty:HandS +output=HTML:Smarty:PHP +;output=HTML:frames:DOM/earthli ;; turn this option on if you want highlighted source code for every file ;; legal values: on/off diff --git a/i18n/knowledgeTree.pot b/i18n/knowledgeTree.pot index c7f803a..2afcf68 100644 --- a/i18n/knowledgeTree.pot +++ b/i18n/knowledgeTree.pot @@ -6669,7 +6669,7 @@ msgid "It is not possible to archive a shortcut. Please archive the target docum msgstr "" #: plugins/ktcore/admin/documentFieldsv2.php:115 -msgid "It is possibler to create different types of fieldsets. The most common kind is a \"normal\" fieldset, which can be configured to have different kinds of fields. The administrator may have installed additional plugins which provide different types of fieldsets." +msgid "It is possible to create different types of fieldsets. The most common kind is a \"normal\" fieldset, which can be configured to have different kinds of fields. The administrator may have installed additional plugins which provide different types of fieldsets." msgstr "" #: i18n/templates.c:7529 diff --git a/ktwebdav/lib/KTWebDAVServer.inc.php b/ktwebdav/lib/KTWebDAVServer.inc.php index d7497cd..466f1c0 100644 --- a/ktwebdav/lib/KTWebDAVServer.inc.php +++ b/ktwebdav/lib/KTWebDAVServer.inc.php @@ -7,31 +7,31 @@ * Document Management Made Simple * Copyright (C) 2008, 2009 KnowledgeTree Inc. * Portions copyright The Jam Warehouse Software (Pty) Limited - * + * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License version 3 as published by the * Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, + * + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, * California 94120-7775, or email info@knowledgetree.com. - * + * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3. - * + * * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by - * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * KnowledgeTree" logo and retain the original copyright notice. If the display of the * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices - * must display the words "Powered by KnowledgeTree" and retain the original + * must display the words "Powered by KnowledgeTree" and retain the original * copyright notice. * Contributor( s): ______________________________________ * @@ -228,7 +228,7 @@ class KTWebDAVServer extends HTTP_WebDAV_Server $ident = 'KTWEBDAV'; $conf = array('mode' => 0644, 'timeFormat' => '%X %x'); - $logger = &Log::singleton('file', '../var/log/ktwebdav-' . date('Y-m-d') . '.txt', $ident, $conf); + $logger = &Log::singleton('file', '../../var/log/ktwebdav-' . date('Y-m-d') . '.txt', $ident, $conf); if ($type == 'error') $logger->log($entry, PEAR_LOG_ERR); else $logger->log($entry, PEAR_LOG_INFO); return true; @@ -272,6 +272,27 @@ class KTWebDAVServer extends HTTP_WebDAV_Server $this->ktwebdavLog('_SERVER is ' . print_r($_SERVER, true), 'info', true); } + // Check for electronic signatures - if enabled exit + $oConfig =& KTConfig::getSingleton(); + $enabled = $oConfig->get('e_signatures/enableApiSignatures', false); + if($enabled){ + $this->ktwebdavLog('Electronic Signatures have been enabled, disabling WebDAV.', 'info'); + + $data = "KTWebDAV - The KnowledgeTree WebDAV Server"; + $data .= ""; + $data .= "

"; + $data .= "

Welcome to KnowledgeTree WebDAV Server



"; + $data .= "
The WebDAV Server has been disabled!


"; + $data .= "
Electronic Signatures are enabled.


"; + $data .= ""; + + header('HTTP/1.1 403 Forbidden'); + header('Content-Type: text/html; charset="utf-8"'); + echo $data; + + exit(0); + } + // Get the client info $this->checkSafeMode(); diff --git a/ktwebservice/KTUploadManager.inc.php b/ktwebservice/KTUploadManager.inc.php index 83a4942..57dc38f 100644 --- a/ktwebservice/KTUploadManager.inc.php +++ b/ktwebservice/KTUploadManager.inc.php @@ -147,6 +147,11 @@ class KTUploadManager $now=date('Y-m-d H:i:s'); $now_str=date('YmdHis'); + // Ensure the temp directory exists otherwise an error is thrown. + if (realpath($this->temp_dir) == FALSE) { + mkdir($this->temp_dir, 0777, true); + } + $newtempfile = realpath($this->temp_dir) . '/' . $_SESSION['userID'] . '-'. $now_str; if (OS_WINDOWS) { diff --git a/lib/foldermanagement/compressionArchiveUtil.inc.php b/lib/foldermanagement/compressionArchiveUtil.inc.php index 4dbba01..a4047b6 100644 --- a/lib/foldermanagement/compressionArchiveUtil.inc.php +++ b/lib/foldermanagement/compressionArchiveUtil.inc.php @@ -289,7 +289,7 @@ class ZipFolder { if (!file_exists($sZipFile)) { return PEAR::raiseError(_kt('The zip file has not been created, if you are downloading a large number of documents - or a large document then it may take a few seconds to finish. Try refreshing the page.')); + or a large document then it may take a few minutes to finish.')); } $mimeType = 'application/zip; charset=utf-8;'; diff --git a/lib/groups/Group.inc b/lib/groups/Group.inc index b122e38..6dd1962 100644 --- a/lib/groups/Group.inc +++ b/lib/groups/Group.inc @@ -163,13 +163,16 @@ class Group extends KTEntity { /** * Returns an array of Users in this group. + * + * @param Boolean Return Disabled Users or Not (defaults false) + * */ - function &getUsers() { + function &getUsers($disabled = false) { // legacy api. - return $this->getMembers(); + return $this->getMembers($disabled); } - function &getMembers() { + function &getMembers($disabled = false) { global $default; require_once(KT_LIB_DIR . '/users/User.inc'); $sQuery = "SELECT user_id FROM $default->users_groups_table WHERE group_id = ?"; @@ -178,10 +181,12 @@ class Group extends KTEntity { $aMembers = array(); foreach ($aUserIds as $iUserId) { $oUser = User::get($iUserId); - if ((!PEAR::isError($oUser)) && ($oUser !== false)) { + $is_disabled = ($disabled) ? false : $oUser->getDisabled(); + if ((!PEAR::isError($oUser)) && ($oUser !== false) && !$is_disabled) { $aMembers[] = $oUser; } } + return $aMembers; } diff --git a/lib/storage/ondiskhashedstoragemanager.inc.php b/lib/storage/ondiskhashedstoragemanager.inc.php index 298b306..01ce9cb 100644 --- a/lib/storage/ondiskhashedstoragemanager.inc.php +++ b/lib/storage/ondiskhashedstoragemanager.inc.php @@ -185,7 +185,10 @@ class KTOnDiskHashedStorageManager extends KTStorageManager { global $default; //get the path to the document on the server - $docRoot = $default->documentRoot; + //$docRoot = $default->documentRoot; + $oConfig =& KTConfig::getSingleton(); + $docRoot = $oConfig->get('urls/documentRoot'); + $path = $docRoot .'/'. $oDocument->getStoragePath(); // Ensure the file exists diff --git a/lib/util/ktutil.inc b/lib/util/ktutil.inc index 96cf3df..2aeeeec 100644 --- a/lib/util/ktutil.inc +++ b/lib/util/ktutil.inc @@ -171,7 +171,7 @@ class KTUtil { $internal_url .= !empty($default->internal_server_port) ? ':' . $default->internal_server_port : ''; $internal_url .= !empty($default->rootUrl) ? $default->rootUrl : ''; - $pos = strpos($internal_url, '://'); + $pos = strpos($internal_url, 'http'); if($pos === false){ $port = $default->internal_server_port; $internal_url = (($port == 443 || $port == 8443) ? 'https://' : 'http://') . $internal_url; @@ -1184,6 +1184,11 @@ class KTUtil { } } + /** + * The system identifier is a unique ID defined in every installation of KnowledgeTree + * + * @return string The system identifier + */ function getSystemIdentifier() { $sIdentifier = KTUtil::getSystemSetting('kt_system_identifier'); if (empty($sIdentifier)) { @@ -1343,7 +1348,7 @@ class KTUtil { return false; } } - + static function camelize($string) { $result = ""; diff --git a/plugins/i18n/french/translations/fr_FR/knowledgeTree.po b/plugins/i18n/french/translations/fr_FR/knowledgeTree.po index d822c82..1bdb9f7 100644 --- a/plugins/i18n/french/translations/fr_FR/knowledgeTree.po +++ b/plugins/i18n/french/translations/fr_FR/knowledgeTree.po @@ -6779,7 +6779,7 @@ msgid "It is not possible to archive a shortcut. Please archive the target docum msgstr "Il est impossible d'archiver un raccourci. Veuillez archiver à la place le document ou le dossier ciblé." #: plugins/ktcore/admin/documentFieldsv2.php:115 -msgid "It is possibler to create different types of fieldsets. The most common kind is a \"normal\" fieldset, which can be configured to have different kinds of fields. The administrator may have installed additional plugins which provide different types of fieldsets." +msgid "It is possible to create different types of fieldsets. The most common kind is a \"normal\" fieldset, which can be configured to have different kinds of fields. The administrator may have installed additional plugins which provide different types of fieldsets." msgstr "Il est possible de créer différents types de formulaires. Le plus commun est un formulaire \"normal\" , qui peut être configuré de facon à disposer de différents types de champs. L'administrateur peut avoir installé des plugins supplémentaires qui fournissent différents types de formulaires." #: i18n/templates.c:7160 diff --git a/plugins/i18n/german/translations/de_DE/knowledgeTree.po b/plugins/i18n/german/translations/de_DE/knowledgeTree.po index 7d33464..5659bbe 100644 --- a/plugins/i18n/german/translations/de_DE/knowledgeTree.po +++ b/plugins/i18n/german/translations/de_DE/knowledgeTree.po @@ -6785,7 +6785,7 @@ msgid "It is not possible to archive a shortcut. Please archive the target docum msgstr "Verknüpfungen können nicht archiviert werden. Bitte archivieren Sie das Zieldokument oder den Zielordner." #: plugins/ktcore/admin/documentFieldsv2.php:115 -msgid "It is possibler to create different types of fieldsets. The most common kind is a \"normal\" fieldset, which can be configured to have different kinds of fields. The administrator may have installed additional plugins which provide different types of fieldsets." +msgid "It is possible to create different types of fieldsets. The most common kind is a \"normal\" fieldset, which can be configured to have different kinds of fields. The administrator may have installed additional plugins which provide different types of fieldsets." msgstr "Es ist möglich verschiedene Typen von Feldgruppen zu erstellen. Die übliche Form ist eine \"normale\" Feldgruppe, welche unterschiedliche Felder beinhalten kann. Der Administrator hat eventuell weitere Plugins installiert die verschiedene Typen von Feldgruppen bereitstellen." #: i18n/templates.c:7160 diff --git a/plugins/i18n/italian/translations/it_IT/knowledgeTree.po b/plugins/i18n/italian/translations/it_IT/knowledgeTree.po index 11f9935..e66d74e 100644 --- a/plugins/i18n/italian/translations/it_IT/knowledgeTree.po +++ b/plugins/i18n/italian/translations/it_IT/knowledgeTree.po @@ -6926,7 +6926,7 @@ msgid "It is not possible to archive a shortcut. Please archive the target docum msgstr "Non è possibile archiviare un collegamento. Si prega di archiviare il documento scelto o la cartella." #: plugins/ktcore/admin/documentFieldsv2.php:115 -msgid "It is possibler to create different types of fieldsets. The most common kind is a \"normal\" fieldset, which can be configured to have different kinds of fields. The administrator may have installed additional plugins which provide different types of fieldsets." +msgid "It is possible to create different types of fieldsets. The most common kind is a \"normal\" fieldset, which can be configured to have different kinds of fields. The administrator may have installed additional plugins which provide different types of fieldsets." msgstr "E' possibile crare tipi diversi di gruppi di attributi. Il tipo più comune è un gruppo di attributi \"normale\", che può essere configurato in modo da avere vari tipi di campi. L'amministratore potrebbe avere installato dei componenti aggiuntivi addizionali che forniscono tipi diversi di gruppi di attributi." #: i18n/templates.c:7175 diff --git a/plugins/ktcore/KTBulkActions.php b/plugins/ktcore/KTBulkActions.php index 2a04c5b..ea6e902 100644 --- a/plugins/ktcore/KTBulkActions.php +++ b/plugins/ktcore/KTBulkActions.php @@ -1081,7 +1081,10 @@ class KTBrowseBulkExportAction extends KTBulkAction { $this->sExportCode = KTUtil::randomString(); $_SESSION['exportcode'] = $this->sExportCode; + // Save the return url in session so it is not lost when doing the download $folderurl = $this->getReturnUrl(); + $_SESSION['export_return_url'] = $folderurl; + $sReturn = sprintf('

' . _kt('Return to the original folder') . "

\n", $folderurl); $download_url = KTUtil::addQueryStringSelf("action=downloadZipFile&fFolderId={$this->oFolder->getId()}&exportcode={$this->sExportCode}"); @@ -1194,7 +1197,8 @@ class KTBrowseBulkExportAction extends KTBulkAction { if(PEAR::isError($res)){ $this->addErrorMessage($res->getMessage()); - $redirectUrl = $this->getReturnUrl(); + $redirectUrl = $_SESSION['export_return_url']; + unset($_SESSION['export_return_url']); redirect($redirectUrl); } exit(0); diff --git a/plugins/ktcore/admin/documentFieldsv2.php b/plugins/ktcore/admin/documentFieldsv2.php index 05201f3..2408999 100644 --- a/plugins/ktcore/admin/documentFieldsv2.php +++ b/plugins/ktcore/admin/documentFieldsv2.php @@ -112,7 +112,7 @@ class KTDocumentFieldDispatcher extends KTAdminDispatcher { $widgets[] = array('ktcore.widgets.selection', array( 'label' => _kt("Fieldset Type"), 'use_simple' => false, - 'description' => _kt("It is possibler to create different types of fieldsets. The most common kind is a \"normal\" fieldset, which can be configured to have different kinds of fields. The administrator may have installed additional plugins which provide different types of fieldsets."), + 'description' => _kt("It is possible to create different types of fieldsets. The most common kind is a \"normal\" fieldset, which can be configured to have different kinds of fields. The administrator may have installed additional plugins which provide different types of fieldsets."), 'important_description' => _kt('Note that it is not possible to convert between different types of fieldsets, so please choose carefully.'), 'name' => 'fieldset_type', 'required' => true, diff --git a/plugins/ktstandard/KTEmail.php b/plugins/ktstandard/KTEmail.php index 7bb3c7d..1f90b6f 100644 --- a/plugins/ktstandard/KTEmail.php +++ b/plugins/ktstandard/KTEmail.php @@ -66,6 +66,7 @@ function sendGroupEmails($aGroupIDs, &$aUserEmails, &$aEmailErrors) { $default->log->info('sendingEmail to group ' . $oDestGroup->getName()); // for each group, retrieve all the users foreach($aDestinationGroups as $oGroup){ + // Need to only retrieve users that are not diabled. $aUsers = kt_array_merge($aUsers, $oGroup->getUsers()); } @@ -245,7 +246,7 @@ function sendEmailDocument($aDestEmailAddress, $iDocumentID, $sDocumentName, $sC $sMessage .= sprintf(_kt("Your colleague, %s, wishes you to view the attached document entitled '%s'."), $oSendingUser->getName(), $sDocumentName); $sMessage .= "\n\n"; if (strlen($sComment) > 0) { - $sMessage .= '

' . _kt('Comments') . ':
' . $sComment; + $sMessage .= '

' . _kt('Comments') . ':
' . nl2br($sComment); } $sTitle = sprintf(_kt("Document (ID %s): %s from %s"), $iDocumentID, $sDocumentName, $oSendingUser->getName()); @@ -310,7 +311,7 @@ function sendEmailHyperlink($aDestEmailAddress, $iDocumentID, $sDocumentName, $s $sMessage .= '
' . generateControllerLink('viewDocument', "fDocumentID=$iDocumentID", $sDocumentName, true); // add optional comment if (strlen($sComment) > 0) { - $sMessage .= '

' . _kt('Comments') . ':
' . $sComment; + $sMessage .= '

' . _kt('Comments') . ':
' . nl2br($sComment); } $sMessage .= ''; $sTitle = sprintf(_kt("Link (ID %s): %s from %s"), $iDocumentID, $sDocumentName, $oSendingUser->getName()); @@ -441,7 +442,6 @@ class KTDocumentEmailAction extends KTDocumentAction { function json_getGroups() { $oConfig = KTConfig::getSingleton(); $bOnlyOwnGroup = $oConfig->get('email/onlyOwnGroups', false); - $sFilter = KTUtil::arrayGet($_REQUEST, 'filter', false); $aGroupList = array('off'=> _kt('-- Please filter --')); @@ -452,7 +452,6 @@ class KTDocumentEmailAction extends KTDocumentAction { } else { $aGroups = GroupUtil::listGroupsForUser($this->oUser, array('where' => $sWhere)); } - $aGroupList = array(); foreach($aGroups as $g) { $aGroupList[$g->getId()] = $g->getName(); @@ -545,13 +544,12 @@ class KTDocumentEmailAction extends KTDocumentAction { $this->errorRedirectToMain(_kt('No recipients set'), sprintf('fDocumentId=%d', $this->oDocument->getId())); exit(0); } - + $iDocumentID = $this->oDocument->getID(); $sDocumentName = $this->oDocument->getName(); $aEmailErrors = array(); $aUserEmails = array(); - // send group emails sendGroupEmails($aGroupIDs, $aUserEmails, $aEmailErrors); // send user emails @@ -569,12 +567,12 @@ class KTDocumentEmailAction extends KTDocumentAction { $aListEmails = array_keys($aUserEmails); sendEmail($aListEmails, $iDocumentID, $sDocumentName, $fComment, (boolean)$fAttachDocument, $aEmailErrors); } - + // Display success or error, not both if (count($aEmailErrors)) { $_SESSION['KTErrorMessage'][] = join('
\n', $aEmailErrors); + } else { + $_SESSION['KTInfoMessage'][] = _kt('Email sent'); } - - $_SESSION['KTInfoMessage'][] = _kt('Email sent'); //go back to the document view page controllerRedirect('viewDocument', sprintf("fDocumentId=%d", $this->oDocument->getId())); } diff --git a/resources/css/kt-framing.css b/resources/css/kt-framing.css index b80dbcf..59c1e05 100644 --- a/resources/css/kt-framing.css +++ b/resources/css/kt-framing.css @@ -1217,15 +1217,15 @@ The text will be hidden for screen view. The generic fahrner-ish approach comes } .portlet_button a .arrow_download { - background: transparent url(../../resources/graphics/download_arrow.gif) top right no-repeat; - width: 27px; + background: transparent url(../../resources/graphics/download_arrow.gif) center right no-repeat; + width: 20px; height: 47px; float: right; } .portlet_button a .arrow_upload { - background: transparent url(../../resources/graphics/upload_arrow.gif) top right no-repeat; - width: 27px; + background: transparent url(../../resources/graphics/upload_arrow.gif) center right no-repeat; + width: 20px; height: 47px; float: right; } diff --git a/resources/graphics/download_arrow.gif b/resources/graphics/download_arrow.gif index c5e1e6b..82238d1 100644 --- a/resources/graphics/download_arrow.gif +++ b/resources/graphics/download_arrow.gif diff --git a/resources/graphics/upload_arrow.gif b/resources/graphics/upload_arrow.gif index 0a668c4..363fe13 100644 --- a/resources/graphics/upload_arrow.gif +++ b/resources/graphics/upload_arrow.gif diff --git a/resources/js/search2widget.js b/resources/js/search2widget.js index df88b37..b4882c5 100644 --- a/resources/js/search2widget.js +++ b/resources/js/search2widget.js @@ -87,6 +87,8 @@ function populateSavedSearch(menu) var item = menu.addMenuItem({ text: sSearchTranslations[5], /*Saved Searches*/ menu: { + shadow: false, + minWidth: '150px', items: [] } }); @@ -118,6 +120,7 @@ function createSearchBar(div, suffix) { var menu = new Ext.menu.Menu({ shadow: false, + minWidth: '200px', items: [ { text: sSearchTranslations[6], /* Advanced Search */ @@ -131,6 +134,7 @@ function createSearchBar(div, suffix) text: sSearchTranslations[8] , /*Quick Search Options*/ menu: { shadow: false, + minWidth: '150px', items: [ new Ext.menu.CheckItem({ text: sSearchTranslations[9], /* content and metadata */ @@ -153,6 +157,7 @@ function createSearchBar(div, suffix) text: sSearchTranslations[13] , /*Toggle results format*/ menu: { shadow: false, + minWidth: '150px', items: [ new Ext.menu.CheckItem({ text: sSearchTranslations[14], /* search engine format */ diff --git a/search2/documentProcessor/documentProcessor.inc.php b/search2/documentProcessor/documentProcessor.inc.php index 65a72f3..f048840 100644 --- a/search2/documentProcessor/documentProcessor.inc.php +++ b/search2/documentProcessor/documentProcessor.inc.php @@ -144,6 +144,16 @@ class DocumentProcessor global $default; $default->log->debug('documentProcessor: starting'); + // Check for lock file to ensure processor is not currently running + $cacheDir = $default->cacheDirectory; + $lockFile = $cacheDir . DIRECTORY_SEPARATOR . 'document_processor.lock'; + + if(file_exists($lockFile)){ + // lock file exists, exit + $default->log->debug('documentProcessor: stopping, lock file in place '.$lockFile); + return ; + } + if($default->enableIndexing){ // Setup indexing - load extractors, run diagnostics if($this->indexer->preIndexingSetup() === false){ @@ -160,6 +170,10 @@ class DocumentProcessor return ; } + // indexing starting - create lock file + touch($lockFile); + + // Process queue foreach($queue as $item){ @@ -198,6 +212,11 @@ class DocumentProcessor // update the indexer statistics $this->indexer->updateIndexStats(); + // Remove lock file to indicate processing has completed + if(file_exists($lockFile)){ + @unlink($lockFile); + } + $default->log->debug('documentProcessor: stopping'); } diff --git a/search2/indexing/indexers/PHPLuceneIndexer.inc.php b/search2/indexing/indexers/PHPLuceneIndexer.inc.php index bc44879..640bc32 100755 --- a/search2/indexing/indexers/PHPLuceneIndexer.inc.php +++ b/search2/indexing/indexers/PHPLuceneIndexer.inc.php @@ -7,31 +7,31 @@ * Document Management Made Simple * Copyright (C) 2008, 2009 KnowledgeTree Inc. * Portions copyright The Jam Warehouse Software (Pty) Limited - * + * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License version 3 as published by the * Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, + * + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, * California 94120-7775, or email info@knowledgetree.com. - * + * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3. - * + * * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by - * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * KnowledgeTree" logo and retain the original copyright notice. If the display of the * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices - * must display the words "Powered by KnowledgeTree" and retain the original + * must display the words "Powered by KnowledgeTree" and retain the original * copyright notice. * Contributor( s): ______________________________________ * @@ -67,9 +67,13 @@ class PHPLuceneIndexer extends Indexer } catch(Exception $ex) { - $this->lucene = null; - if (!$catchException) - throw $ex; + if($ex->getMessage() == "Index doesn't exists in the specified directory."){ + $this->lucene = new Zend_Search_Lucene($indexPath, true); + }else { + $this->lucene = null; + if (!$catchException) + throw $ex; + } } } @@ -94,13 +98,16 @@ class PHPLuceneIndexer extends Indexer */ private function addDocument($docid, $content, $discussion, $title, $version) { - $doc = new Zend_Search_Lucene_Document(); - $doc->addField(Zend_Search_Lucene_Field::Text('DocumentID', PHPLuceneIndexer::longToString($docid))); - $doc->addField(Zend_Search_Lucene_Field::Text('Content', $content, 'UTF-8')); - $doc->addField(Zend_Search_Lucene_Field::Text('Discussion', $discussion, 'UTF-8')); - $doc->addField(Zend_Search_Lucene_Field::Text('Title', $title, 'UTF-8')); - $doc->addField(Zend_Search_Lucene_Field::Text('Version', $version, 'UTF-8')); - $this->lucene->addDocument($doc); + $teaser = substr($content, 0, 250); + + $doc = new Zend_Search_Lucene_Document(); + $doc->addField(Zend_Search_Lucene_Field::Text('DocumentID', PHPLuceneIndexer::longToString($docid))); + $doc->addField(Zend_Search_Lucene_Field::Text('Content', $content, 'UTF-8')); + $doc->addField(Zend_Search_Lucene_Field::unStored('Discussion', $discussion, 'UTF-8')); + $doc->addField(Zend_Search_Lucene_Field::Text('Title', $title, 'UTF-8')); + $doc->addField(Zend_Search_Lucene_Field::Text('Version', $version, 'UTF-8')); + $doc->addField(Zend_Search_Lucene_Field::unIndexed('Summary', $teaser, 'UTF-8')); + $this->lucene->addDocument($doc); } /** @@ -232,6 +239,7 @@ class PHPLuceneIndexer extends Indexer $document_id = PHPLuceneIndexer::stringToLong($document->DocumentID); + /* $coreText = ''; if ($queryContent) { @@ -243,6 +251,11 @@ class PHPLuceneIndexer extends Indexer } $content = $query->highlightMatches($coreText); + */ + + $teaser = $document->Summary; + + $content = $query->highlightMatches($teaser); $title = $document->Title; $score = $hit->score; @@ -250,6 +263,7 @@ class PHPLuceneIndexer extends Indexer // avoid adding duplicates. If it is in already, it has higher priority. if (!array_key_exists($document_id, $results) || $score > $results[$document_id]->Score) { + $item = new DocumentResultItem($document_id, $score, $title, $content); $item = new QueryResultItem($document_id, $score, $title, $content); if ($item->CanBeReadByUser) { @@ -284,4 +298,8 @@ class PHPLuceneIndexer extends Indexer return _kt('Document Indexer Library'); } } -?> + + public function isDocumentIndexed($documentId){ + // do something + } +?> \ No newline at end of file diff --git a/search2/indexing/lib/XmlRpcLucene.inc.php b/search2/indexing/lib/XmlRpcLucene.inc.php index d8ec457..016e6f0 100755 --- a/search2/indexing/lib/XmlRpcLucene.inc.php +++ b/search2/indexing/lib/XmlRpcLucene.inc.php @@ -297,7 +297,7 @@ class XmlRpcLucene ); $result =& $this->client->send($function); - unset($buffer); + unset($content); if($result->faultCode()) { $this->error($result, 'extractTextContent'); diff --git a/sql/mysql/install/data.sql b/sql/mysql/install/data.sql index d81fafe..a5e71d4 100644 --- a/sql/mysql/install/data.sql +++ b/sql/mysql/install/data.sql @@ -1459,7 +1459,7 @@ LOCK TABLES `system_settings` WRITE; INSERT INTO `system_settings` VALUES (1,'lastIndexUpdate','0'), (2,'knowledgeTreeVersion','3.6.1'), -(3,'databaseVersion','3.6.0'), +(3,'databaseVersion','3.6.1'), (4,'server_name','127.0.0.1'); /*!40000 ALTER TABLE `system_settings` ENABLE KEYS */; UNLOCK TABLES; @@ -1753,7 +1753,8 @@ INSERT INTO `upgrades` VALUES (214,'func*3.5.4a*0*removeOldFilesAndFolders354a','Remove old files and folders that are no longer needed.','2008-10-01 00:00:00',1,'upgrade*3.5.4a*99*upgrade3.5.4a'), (215,'func*3.5.4a*0*removeOldFilesAndFolders354a1','Remove old files and folders that are no longer needed.','2008-10-01 00:00:00',1,'upgrade*3.5.4a*99*upgrade3.5.4a'), (216,'upgrade*3.5.4a*99*upgrade3.5.4a','Upgrade from version 3.5.4 to 3.5.4a','2008-12-01 00:00:00',1,'upgrade*3.5.4a*99*upgrade3.5.4a'), -(217,'upgrade*3.6.0*99*upgrade3.6.0','Upgrade from version 3.5.4a to 3.6.0','2009-01-01 00:00:00',1,'upgrade*3.6.0*99*upgrade3.6.0'); +(217,'upgrade*3.6.0*99*upgrade3.6.0','Upgrade from version 3.5.4a to 3.6.0','2009-01-01 00:00:00',1,'upgrade*3.6.0*99*upgrade3.6.0'), +(218,'upgrade*3.6.1*99*upgrade3.6.1','Upgrade from version 3.6.0 to 3.6.1','2009-04-01 00:00:00',1,'upgrade*3.6.1*99*upgrade3.6.1'); /*!40000 ALTER TABLE `upgrades` ENABLE KEYS */; UNLOCK TABLES; diff --git a/templates/ktcore/search2/adv_query_builder.smarty b/templates/ktcore/search2/adv_query_builder.smarty index fb9bbf8..ad40065 100755 --- a/templates/ktcore/search2/adv_query_builder.smarty +++ b/templates/ktcore/search2/adv_query_builder.smarty @@ -183,15 +183,16 @@ function createRange(groupid, fid, type) html += "