Importación inicial con versión 3.7.0.2 original
git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_SGD/tags/3.7.0.2_original@1 eb19766c-00d9-a042-a3a0-45cb8ec72764
This commit is contained in:
commit
28b02db2ea
81
about.php
Normal file
81
about.php
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): ______________________________________
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
// main library routines and defaults
|
||||||
|
require_once("config/dmsDefaults.php");
|
||||||
|
require_once(KT_LIB_DIR . "/unitmanagement/Unit.inc");
|
||||||
|
|
||||||
|
require_once(KT_LIB_DIR . "/templating/templating.inc.php");
|
||||||
|
require_once(KT_LIB_DIR . "/dispatcher.inc.php");
|
||||||
|
require_once(KT_LIB_DIR . "/widgets/forms.inc.php");
|
||||||
|
|
||||||
|
class KTAbout extends KTStandardDispatcher {
|
||||||
|
var $sSection = 'aboutkt';
|
||||||
|
|
||||||
|
function do_main() {
|
||||||
|
global $default;
|
||||||
|
$this->aBreadcrumbs = array(array('action' => 'aboutkt', 'name' => _kt("About")));
|
||||||
|
$oUser =& $this->oUser;
|
||||||
|
|
||||||
|
$oTemplating =& KTTemplating::getSingleton();
|
||||||
|
$oTemplate = $oTemplating->loadTemplate("ktcore/principals/about");
|
||||||
|
|
||||||
|
$aVersionInfo = explode(' ', $default->versionName);
|
||||||
|
foreach($aVersionInfo as $sVersionpiece){
|
||||||
|
if(substr($sVersionpiece, 1, 1) == '.'){
|
||||||
|
$sVersionNo = $sVersionpiece;
|
||||||
|
}else{
|
||||||
|
$sVersionName .= " ".$sVersionpiece;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$aTemplateData = array(
|
||||||
|
"context" => $this,
|
||||||
|
"versionname" => $sVersionName,
|
||||||
|
"versionnumber" => $sVersionNo,
|
||||||
|
'smallVersion' => substr($default->versionName, -18, -1),
|
||||||
|
);
|
||||||
|
return $oTemplate->render($aTemplateData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$oDispatcher = new KTAbout();
|
||||||
|
$oDispatcher->dispatch();
|
||||||
|
|
||||||
|
?>
|
||||||
201
action.php
Normal file
201
action.php
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): ______________________________________
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once('config/dmsDefaults.php');
|
||||||
|
require_once(KT_LIB_DIR . '/actions/actionregistry.inc.php');
|
||||||
|
require_once(KT_LIB_DIR . '/dispatcher.inc.php');
|
||||||
|
|
||||||
|
// Strip html tags out of the request action to prevent XSS attacks
|
||||||
|
// This is done here to ensure that it is done for all places that use the variables.
|
||||||
|
$_REQUEST['fReturnAction'] = strip_tags($_REQUEST['fReturnAction']);
|
||||||
|
$_REQUEST['fReturnData'] = strip_tags($_REQUEST['fReturnData']);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Using KTStandardDispatcher for errorPage, overriding handleOutput as
|
||||||
|
* the document action dispatcher will handle that.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatcher for action.php/actionname
|
||||||
|
*
|
||||||
|
* This dispatcher looks up the action from the Action Registry, and
|
||||||
|
* then chains onto that action's dispatcher.
|
||||||
|
*/
|
||||||
|
class KTActionDispatcher extends KTStandardDispatcher {
|
||||||
|
/**
|
||||||
|
* Default dispatch
|
||||||
|
*
|
||||||
|
* Find the action, and then use its dispatcher. Error out nicely
|
||||||
|
* if we aren't so lucky.
|
||||||
|
*/
|
||||||
|
function do_main() {
|
||||||
|
$this->error = false;
|
||||||
|
$action = KTUtil::arrayGet($_SERVER, 'PATH_INFO');
|
||||||
|
$action = trim($action);
|
||||||
|
$action = trim($action, '/');
|
||||||
|
if (empty($action)) {
|
||||||
|
$this->error = true;
|
||||||
|
$this->errorPage(_kt('No action given'));
|
||||||
|
}
|
||||||
|
$oRegistry =& KTActionRegistry::getSingleton();
|
||||||
|
$aActionInfo = $oRegistry->getActionByNsname($action);
|
||||||
|
if (empty($aActionInfo)) {
|
||||||
|
$this->error = true;
|
||||||
|
$this->errorPage(sprintf(_kt('No such action exists in %s'), APP_NAME));
|
||||||
|
}
|
||||||
|
$sFilename = $aActionInfo[1];
|
||||||
|
if (!empty($sFilename)) {
|
||||||
|
require_once($sFilename);
|
||||||
|
}
|
||||||
|
$oAction = new $aActionInfo[0];
|
||||||
|
$oAction->dispatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
function json_main() {
|
||||||
|
return $this->do_main();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBulkReturnUrl(){
|
||||||
|
$sReturnAction = $_REQUEST['fReturnAction'];
|
||||||
|
$sReturnData = $_REQUEST['fReturnData'];
|
||||||
|
$sAction = 'main';
|
||||||
|
$qs = '';
|
||||||
|
|
||||||
|
switch ($sReturnAction){
|
||||||
|
case 'browse':
|
||||||
|
$sReturnData = (empty($sReturnData)) ? $_REQUEST['fFolderId'] : $sReturnData;
|
||||||
|
$sTargetUrl = KTBrowseUtil::getUrlForFolder(Folder::get($sReturnData));
|
||||||
|
break;
|
||||||
|
case 'simpleSearch':
|
||||||
|
$sTargetUrl = KTBrowseUtil::getSimpleSearchBaseUrl();
|
||||||
|
$extra = 'fSearchableText='.$sReturnData;
|
||||||
|
break;
|
||||||
|
case 'booleanSearch':
|
||||||
|
$sTargetUrl = KTBrowseUtil::getBooleanSearchBaseUrl();
|
||||||
|
$sAction = 'performSearch';
|
||||||
|
$extra = 'boolean_search_id='.$sReturnData;
|
||||||
|
break;
|
||||||
|
case 'search2':
|
||||||
|
$sTargetUrl = KTBrowseUtil::getSearchResultURL();
|
||||||
|
$sAction = 'searchResults';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$sTargetUrl = $sReturnAction;
|
||||||
|
$sAction = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$qs = (!empty($sAction))? 'action='.$sAction : '';
|
||||||
|
$qs .= (!empty($extra))? '&'.$extra : '';
|
||||||
|
$sTargetUrl = KTUtil::addQueryString($sTargetUrl, $qs);
|
||||||
|
|
||||||
|
return $sTargetUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
function do_bulkaction() {
|
||||||
|
$act = (array) KTUtil::arrayGet($_REQUEST, 'submit',null);
|
||||||
|
|
||||||
|
$targets = array_keys($act);
|
||||||
|
if (!empty($targets)) {
|
||||||
|
$target = $targets[0];
|
||||||
|
} else {
|
||||||
|
$this->errorRedirectToBrowse(_kt('No action selected.'));
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
$aFolderSelection = KTUtil::arrayGet($_REQUEST, 'selection_f' , array());
|
||||||
|
$aDocumentSelection = KTUtil::arrayGet($_REQUEST, 'selection_d' , array());
|
||||||
|
|
||||||
|
$oFolder = Folder::get(KTUtil::arrayGet($_REQUEST, 'fFolderId', 1));
|
||||||
|
if (PEAR::isError($oFolder)) {
|
||||||
|
$redirectUrl = $this->getBulkReturnUrl();
|
||||||
|
if(!empty($redirectUrl)){
|
||||||
|
$this->addErrorMessage(_kt('Invalid folder selected.'));
|
||||||
|
redirect($redirectUrl);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
$this->errorRedirectToBrowse(_kt('Invalid folder selected.'));
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($aFolderSelection) && empty($aDocumentSelection)) {
|
||||||
|
$redirectUrl = $this->getBulkReturnUrl();
|
||||||
|
if(!empty($redirectUrl)){
|
||||||
|
$this->addErrorMessage(_kt('Please select documents or folders first.'));
|
||||||
|
redirect($redirectUrl);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
$this->errorRedirectToBrowse(_kt('Please select documents or folders first.'), sprintf('fFolderId=%d', $oFolder->getId()));
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// prepare for passing to bulk actions
|
||||||
|
$oActionRegistry =& KTActionRegistry::getSingleton();
|
||||||
|
$oAction =& $oActionRegistry->initializeAction($target, $this->oUser);
|
||||||
|
|
||||||
|
if(!$oAction || PEAR::isError($oAction)) {
|
||||||
|
$this->errorRedirectToBrowse(_kt('No such action.'));
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
$oAction->oFolder = $oFolder;
|
||||||
|
|
||||||
|
$oEntityList = new KTEntityList($aDocumentSelection, $aFolderSelection);
|
||||||
|
$oAction->setEntityList($oEntityList);
|
||||||
|
$oAction->redispatch('action', 'do_', $this);
|
||||||
|
|
||||||
|
// exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle output from this dispatcher.
|
||||||
|
*
|
||||||
|
* If there's an error in _this_ dispatcher, use the standard
|
||||||
|
* surroundings. If not, don't put anything around the output - the
|
||||||
|
* chained dispatcher will take care of that.
|
||||||
|
*/
|
||||||
|
function handleOutput ($data) {
|
||||||
|
if ($this->bJSONMode || $this->error) {
|
||||||
|
parent::handleOutput($data);
|
||||||
|
} else {
|
||||||
|
print $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$d = new KTActionDispatcher();
|
||||||
|
$d->dispatch();
|
||||||
171
admin.php
Normal file
171
admin.php
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): ______________________________________
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once('config/dmsDefaults.php');
|
||||||
|
require_once(KT_LIB_DIR . '/templating/kt3template.inc.php');
|
||||||
|
require_once(KT_LIB_DIR . '/dispatcher.inc.php');
|
||||||
|
require_once(KT_LIB_DIR . '/widgets/portlet.inc.php');
|
||||||
|
|
||||||
|
require_once(KT_LIB_DIR . '/plugins/KTAdminNavigation.php');
|
||||||
|
|
||||||
|
class AdminSplashDispatcher extends KTAdminDispatcher {
|
||||||
|
var $category = '';
|
||||||
|
var $sSection = 'administration';
|
||||||
|
|
||||||
|
function AdminSplashDispatcher() {
|
||||||
|
$this->aBreadcrumbs = array(
|
||||||
|
array('url' => KTUtil::getRequestScriptName($_SERVER), 'name' => _kt('Administration')),
|
||||||
|
);
|
||||||
|
|
||||||
|
parent::KTAdminDispatcher();
|
||||||
|
}
|
||||||
|
|
||||||
|
function do_main() {
|
||||||
|
if ($this->category !== '') {
|
||||||
|
return $this->do_viewCategory();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// are we categorised, or not?
|
||||||
|
$oRegistry =& KTAdminNavigationRegistry::getSingleton();
|
||||||
|
$categories = $oRegistry->getCategories();
|
||||||
|
$KTConfig =& KTConfig::getSingleton();
|
||||||
|
$condensed_admin = $KTConfig->get('condensedAdminUI');
|
||||||
|
|
||||||
|
$aAllItems = array();
|
||||||
|
// we need to investigate sub_url solutions.
|
||||||
|
if ($condensed_admin) {
|
||||||
|
foreach ($categories as $aCategory) {
|
||||||
|
$aItems = $oRegistry->getItemsForCategory($aCategory['name']);
|
||||||
|
$aAllItems[$aCategory['name']] = $aItems;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->oPage->title = _kt('Administration') . ': ';
|
||||||
|
$oTemplating =& KTTemplating::getSingleton();
|
||||||
|
|
||||||
|
if ($condensed_admin) {
|
||||||
|
$oTemplate = $oTemplating->loadTemplate('kt3/admin_fulllist');
|
||||||
|
} else {
|
||||||
|
$oTemplate = $oTemplating->loadTemplate('kt3/admin_categories');
|
||||||
|
}
|
||||||
|
|
||||||
|
$aTemplateData = array(
|
||||||
|
'context' => $this,
|
||||||
|
'categories' => $categories,
|
||||||
|
'all_items' => $aAllItems,
|
||||||
|
'baseurl' => $_SERVER['PHP_SELF'],
|
||||||
|
);
|
||||||
|
return $oTemplate->render($aTemplateData);
|
||||||
|
}
|
||||||
|
|
||||||
|
function do_viewCategory() {
|
||||||
|
// are we categorised, or not?
|
||||||
|
$category = KTUtil::arrayGet($_REQUEST, 'fCategory', $this->category);
|
||||||
|
|
||||||
|
//Removing bad documents/fieldmanagement links from the Document Metadata and Workflow Configuration page.
|
||||||
|
if ($category == 'documents') {
|
||||||
|
$oPage =& $GLOBALS['main'];
|
||||||
|
$aJavascript[] = 'thirdpartyjs/jquery/jquery-1.3.2.js';
|
||||||
|
$oPage->requireJSResources($aJavascript);
|
||||||
|
$jscript .= "<script src='resources/js/kt_hideadminlink.js' type='text/javascript'></script>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$oRegistry =& KTAdminNavigationRegistry::getSingleton();
|
||||||
|
$aCategory = $oRegistry->getCategory($category);
|
||||||
|
|
||||||
|
$aItems = $oRegistry->getItemsForCategory($category);
|
||||||
|
asort($aItems);
|
||||||
|
$this->aBreadcrumbs[] = array('name' => $aCategory['title'], 'url' => KTUtil::ktLink('admin.php',$category));
|
||||||
|
|
||||||
|
$this->oPage->title = _kt('Administration') . ': ' . $aCategory['title'];
|
||||||
|
$oTemplating =& KTTemplating::getSingleton();
|
||||||
|
$oTemplate = $oTemplating->loadTemplate('kt3/admin_items');
|
||||||
|
$aTemplateData = array(
|
||||||
|
'context' => $this,
|
||||||
|
'category' => $aCategory,
|
||||||
|
'items' => $aItems,
|
||||||
|
'baseurl' => $_SERVER['PHP_SELF'],
|
||||||
|
'jscript' => $jscript,
|
||||||
|
);
|
||||||
|
return $oTemplate->render($aTemplateData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sub_url = KTUtil::arrayGet($_SERVER, 'PATH_INFO');
|
||||||
|
|
||||||
|
$sub_url = trim($sub_url);
|
||||||
|
$sub_url= trim($sub_url, '/');
|
||||||
|
|
||||||
|
if (empty($sub_url)) {
|
||||||
|
$oDispatcher = new AdminSplashDispatcher();
|
||||||
|
} else {
|
||||||
|
$oRegistry =& KTAdminNavigationRegistry::getSingleton();
|
||||||
|
if ($oRegistry->isRegistered($sub_url)) {
|
||||||
|
$oDispatcher = $oRegistry->getDispatcher($sub_url);
|
||||||
|
|
||||||
|
$aParts = explode('/',$sub_url);
|
||||||
|
|
||||||
|
$oRegistry =& KTAdminNavigationRegistry::getSingleton();
|
||||||
|
$aCategory = $oRegistry->getCategory($aParts[0]);
|
||||||
|
|
||||||
|
$oDispatcher->aBreadcrumbs = array();
|
||||||
|
$oDispatcher->aBreadcrumbs[] = array('action' => 'administration', 'name' => _kt('Administration'));
|
||||||
|
$oDispatcher->aBreadcrumbs[] = array('name' => $aCategory['title'], 'url' => KTUtil::ktLink('admin.php',$aParts[0]));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// FIXME (minor) redirect to no-suburl?
|
||||||
|
$oDispatcher = new AdminSplashDispatcher();
|
||||||
|
$oDispatcher->category = $sub_url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Implement an electronic signature for accessing the admin section, it will appear every 10 minutes
|
||||||
|
global $main;
|
||||||
|
global $default;
|
||||||
|
if($default->enableAdminSignatures && $_SESSION['electronic_signature_time'] < time()){
|
||||||
|
$sBaseUrl = KTUtil::kt_url();
|
||||||
|
$sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true);
|
||||||
|
$heading = _kt('You are attempting to access Administration');
|
||||||
|
$main->setBodyOnload("javascript: showSignatureForm('{$sUrl}', '{$heading}', 'dms.administration.administration_section_access', 'admin', '{$sBaseUrl}/browse.php', 'close');");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$oDispatcher->dispatch(); // we _may_ be redirected at this point (see KTAdminNavigation)
|
||||||
|
|
||||||
|
?>
|
||||||
4
bin/.htaccess
Normal file
4
bin/.htaccess
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Order deny,allow
|
||||||
|
Allow from all
|
||||||
|
|
||||||
|
IndexIgnore *.*
|
||||||
47
bin/ajaxtasks/downloadTask.php
Normal file
47
bin/ajaxtasks/downloadTask.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
chdir(dirname(__FILE__));
|
||||||
|
require_once('../../config/dmsDefaults.php');
|
||||||
|
require_once(KT_LIB_DIR . '/foldermanagement/compressionArchiveUtil.inc.php');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The download task provides 2 pieces of functionality. The first is to process the download queue and the second is to "ping" the download queue.
|
||||||
|
* The processing of the download queue will create the archives for the bulk download action and set a flag to indicate their completion.
|
||||||
|
* The "ping" will check if the flag has been set and inform the user that the archive is ready for download.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$queue = new DownloadQueue();
|
||||||
|
|
||||||
|
// Check for a ping then check if the download is finished
|
||||||
|
$ping = isset($_POST['ping']) ? $_POST['ping'] : false;
|
||||||
|
if($ping == 'ping'){
|
||||||
|
|
||||||
|
$code = $_POST['code'];
|
||||||
|
$status = $queue->isDownloadAvailable($code);
|
||||||
|
|
||||||
|
if($status === false){
|
||||||
|
echo 'wait';
|
||||||
|
}else{
|
||||||
|
$str = '';
|
||||||
|
// display any error messages
|
||||||
|
if(!empty($status)){
|
||||||
|
$str = '<div><b>'._kt('The following errors occurred during the download').': </><br />';
|
||||||
|
$str .= '<table style="padding-top: 5px;" cellspacing="0" cellpadding="5">';
|
||||||
|
foreach ($status as $msg){
|
||||||
|
$str .= '<tr><td style="border: 1px #888 solid;">'.$msg.'</td></tr>';
|
||||||
|
}
|
||||||
|
$str .= '</table></div>';
|
||||||
|
}
|
||||||
|
echo $str;
|
||||||
|
}
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($queue->isLocked()){
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
// Not a ping, process the queue
|
||||||
|
$queue->processQueue();
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
?>
|
||||||
94
bin/automated_upgrade.php
Normal file
94
bin/automated_upgrade.php
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): ______________________________________
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once('../config/dmsDefaults.php');
|
||||||
|
require_once(KT_DIR . '/lib/upgrades/upgrade.inc.php');
|
||||||
|
|
||||||
|
if (!($default->dbAdminUser && $default->dbAdminPass)) {
|
||||||
|
print "You need to set up the administrator user for your database.\n";
|
||||||
|
print "Consult docs/UPGRADE.txt for more information\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PEAR::isError($default->_admindb)) {
|
||||||
|
print "Your database administrator user credentials can not login.\n";
|
||||||
|
print "Consult docs/UPGRADE.txt for more information.\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = sprintf('SELECT value FROM %s WHERE name = "knowledgeTreeVersion"', $default->system_settings_table);
|
||||||
|
$lastVersion = DBUtil::getOneResultKey($query, 'value');
|
||||||
|
$currentVersion = $default->systemVersion;
|
||||||
|
|
||||||
|
$action = $_SERVER['argv'][1];
|
||||||
|
if (empty($action)) {
|
||||||
|
$action = 'show';
|
||||||
|
}
|
||||||
|
|
||||||
|
$upgrades = describeUpgrade($lastVersion, $currentVersion);
|
||||||
|
|
||||||
|
$i = 1;
|
||||||
|
foreach ($upgrades as $step) {
|
||||||
|
print "Upgrade step $i: " . $step->getDescription();
|
||||||
|
$bApplied = $step->isAlreadyApplied();
|
||||||
|
$i++;
|
||||||
|
if ($bApplied) {
|
||||||
|
print " (already applied)\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
print "\n";
|
||||||
|
if ($action == 'show') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$res = $step->performUpgrade();
|
||||||
|
print ' RESULT: ';
|
||||||
|
if ($res === true) {
|
||||||
|
print 'Success';
|
||||||
|
}
|
||||||
|
if (PEAR::isError($res)) {
|
||||||
|
if (is_a($res, strtolower('Upgrade_Already_Applied'))) {
|
||||||
|
print 'Already applied';
|
||||||
|
} else {
|
||||||
|
print "ERROR\n";
|
||||||
|
print $res->toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
199
bin/checkopenoffice.php
Normal file
199
bin/checkopenoffice.php
Normal file
@ -0,0 +1,199 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* $Id:
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): ______________________________________
|
||||||
|
*/
|
||||||
|
|
||||||
|
chdir(realpath(dirname(__FILE__)));
|
||||||
|
require_once('../config/dmsDefaults.php');
|
||||||
|
|
||||||
|
/*
|
||||||
|
Script checks if open office is running, if it isn't then it attempts to start it.
|
||||||
|
|
||||||
|
Windows Vista always returns false if we try and check the host and port
|
||||||
|
so for windows we use the win32 service status checks.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Check if the calling function requires a return value
|
||||||
|
$sGiveOutput = (isset($argv[1]) && $argv[1] == 'output') ? true : false;
|
||||||
|
|
||||||
|
// Check indexed document count
|
||||||
|
// If the number of indexed documents is greater than the set amount, restart open office
|
||||||
|
// this clears open office's memory usage
|
||||||
|
$resetPoint = 50; // todo: put in config
|
||||||
|
$count = Indexer::getIndexedDocumentCount();
|
||||||
|
|
||||||
|
$restartOO = false;
|
||||||
|
if($count > $resetPoint){
|
||||||
|
$restartOO = true;
|
||||||
|
|
||||||
|
// reset the count
|
||||||
|
Indexer::updateIndexedDocumentCount(0);
|
||||||
|
$default->log->debug('Check Open Office Task: Restarting open office.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// First we check the host:port to see if open office is running
|
||||||
|
$sCheckOO = SearchHelper::checkOpenOfficeAvailablity();
|
||||||
|
|
||||||
|
if(empty($sCheckOO) && !$restartOO){
|
||||||
|
// If the check returns empty then it is available on that port so we exit
|
||||||
|
if($sGiveOutput){
|
||||||
|
echo 1;
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Open office appears not to be running or requires a restart
|
||||||
|
if(OS_WINDOWS){
|
||||||
|
$OOService = 'ktopenoffice';
|
||||||
|
$default->log->debug('Check Open Office Task: ' . get_current_user());
|
||||||
|
|
||||||
|
if($restartOO){
|
||||||
|
// If Open office needs to be restarted - stop it here
|
||||||
|
$result_stop = win32_stop_service($OOService);
|
||||||
|
|
||||||
|
|
||||||
|
// Wait for the service to stop fully before trying to restart it
|
||||||
|
$continue = false;
|
||||||
|
$cnt = 0;
|
||||||
|
while($continue === false && $cnt < 15){
|
||||||
|
$result = win32_query_service_status($OOService);
|
||||||
|
|
||||||
|
if(isset($result['ProcessId']) && $result['ProcessId'] != 0){
|
||||||
|
// If there is still a process id then the service has not stopped yet.
|
||||||
|
sleep(2);
|
||||||
|
$continue = false;
|
||||||
|
$cnt++;
|
||||||
|
}else{
|
||||||
|
$continue = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
// If this is vista, checking the port may not work so we query the service
|
||||||
|
$result = win32_query_service_status($OOService);
|
||||||
|
|
||||||
|
if(is_array($result)){
|
||||||
|
$iProcessId = $result['ProcessId'];
|
||||||
|
if(!empty($iProcessId) && $iProcessId != 0){
|
||||||
|
// If there is a process id (PID) then open office is running so we exit
|
||||||
|
if($sGiveOutput){
|
||||||
|
echo 1;
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Service is not running - log it and attempt to start
|
||||||
|
$default->log->error('Check Open Office Task: Open office service is not running... trying to start it.');
|
||||||
|
|
||||||
|
// Use the win32 service start
|
||||||
|
$result2 = win32_start_service($OOService);
|
||||||
|
|
||||||
|
if($result2 == 0){
|
||||||
|
// Service started successfully
|
||||||
|
$default->log->debug('Check Open Office Task: Open office service started.');
|
||||||
|
if($sGiveOutput){
|
||||||
|
echo 1;
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$default->log->error('Check Open Office Task: Open office service could not be started. Error code '.$result2);
|
||||||
|
|
||||||
|
// Attempt using the dmsctl batch script
|
||||||
|
$sPath = realpath('../../bin/dmsctl.bat');
|
||||||
|
|
||||||
|
if(file_exists($sPath)){
|
||||||
|
$sCmd = "\"$sPath\" start";
|
||||||
|
$default->log->debug('Check Open Office Task: ' . get_current_user());
|
||||||
|
$default->log->debug('Check Open Office Task: ' . $sCmd);
|
||||||
|
|
||||||
|
$res = KTUtil::pexec($sCmd);
|
||||||
|
|
||||||
|
$default->log->debug('Check Open Office Task: Attempted start using dmsctl.bat.');
|
||||||
|
if($sGiveOutput){
|
||||||
|
echo 2;
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}else{
|
||||||
|
$default->log->debug('Check Open Office Task: Can\'t find dmsctl.bat, this may be a source install.');
|
||||||
|
if($sGiveOutput){
|
||||||
|
echo 0;
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
// If the OS is Unix or Linux
|
||||||
|
$sPath = realpath('../../dmsctl.sh');
|
||||||
|
if(file_exists($sPath)){
|
||||||
|
// If Open office needs to be restarted - stop it here
|
||||||
|
if($restartOO){
|
||||||
|
$sCmd = "\"$sPath\" restart soffice >/dev/null &";
|
||||||
|
$default->log->debug('Check Open Office Task: ' . get_current_user());
|
||||||
|
$default->log->debug('Check Open Office Task: ' . $sCmd);
|
||||||
|
|
||||||
|
KTUtil::pexec($sCmd);
|
||||||
|
|
||||||
|
$default->log->debug('Check Open Office Task: Attempted restart using dmsctl.sh.');
|
||||||
|
}else{
|
||||||
|
$sCmd = "\"$sPath\" start soffice >/dev/null &";
|
||||||
|
$default->log->debug('Check Open Office Task: ' . get_current_user());
|
||||||
|
$default->log->debug('Check Open Office Task: ' . $sCmd);
|
||||||
|
|
||||||
|
KTUtil::pexec($sCmd);
|
||||||
|
|
||||||
|
$default->log->debug('Check Open Office Task: Attempted start using dmsctl.sh.');
|
||||||
|
}
|
||||||
|
if($sGiveOutput){
|
||||||
|
echo 2;
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}else{
|
||||||
|
$default->log->debug('Check Open Office Task: Can\'t find dmsctl.sh, this may be a source install.');
|
||||||
|
if($sGiveOutput){
|
||||||
|
echo 0;
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$default->log->debug('Check Open Office Task: Can\'t start Open office, this may be a source install.');
|
||||||
|
if($sGiveOutput){
|
||||||
|
echo 0;
|
||||||
|
}
|
||||||
|
exit(0);
|
||||||
|
?>
|
||||||
202
bin/cleanup.php
Normal file
202
bin/cleanup.php
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): ______________________________________
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once('../config/dmsDefaults.php');
|
||||||
|
require_once(KT_LIB_DIR . '/config/config.inc.php');
|
||||||
|
require_once(KT_LIB_DIR . '/browse/browseutil.inc.php');
|
||||||
|
|
||||||
|
$oConfig =& KTConfig::getSingleton();
|
||||||
|
$fsPath = $oConfig->get('urls/documentRoot');
|
||||||
|
|
||||||
|
$aIgnore = array(
|
||||||
|
'.', '..',
|
||||||
|
'CVS',
|
||||||
|
'.empty',
|
||||||
|
'.htaccess',
|
||||||
|
'.cvsignore',
|
||||||
|
);
|
||||||
|
|
||||||
|
$aFoldersToRemove = array();
|
||||||
|
$aFilesToRemove = array();
|
||||||
|
$aRepoDocumentProblems = array();
|
||||||
|
$aRepoFolderProblems = array();
|
||||||
|
$aRepoVersionProblems = array();
|
||||||
|
|
||||||
|
function checkFileVersion($path, $version) {
|
||||||
|
$fod = KTBrowseUtil::folderOrDocument($path);
|
||||||
|
if ($fod === false) {
|
||||||
|
// No document by that name, so no point checking version
|
||||||
|
// information.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkFile($path, $first = true) {
|
||||||
|
$pattern = "/^(.*)-((?:\d+)\.(?:\d+))$/";
|
||||||
|
if (preg_match($pattern, $path, $matches)) {
|
||||||
|
if (checkFileVersion($matches[1], $matches[2])) {
|
||||||
|
// If it's a version, then don't check for full path
|
||||||
|
// below...
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$fod = KTBrowseUtil::folderOrDocument($path);
|
||||||
|
if ($fod === false) {
|
||||||
|
$GLOBALS['aFilesToRemove'][] = $path;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkDirectory($path) {
|
||||||
|
global $fsPath, $aIgnore;
|
||||||
|
$fullpath = sprintf('%s/%s', $fsPath, $path);
|
||||||
|
|
||||||
|
if (!is_dir($fullpath)) {
|
||||||
|
print "Not a directory: $fullpath\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($path === '/Deleted') {
|
||||||
|
// Deleted files handled separately.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($path)) {
|
||||||
|
$fod = KTBrowseUtil::folderOrDocument($path);
|
||||||
|
if ($fod === false) {
|
||||||
|
$GLOBALS['aFoldersToRemove'][] = $path;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$dh = @opendir($fullpath);
|
||||||
|
if ($dh === false) {
|
||||||
|
print "Could not open directory: $fullpath\n";
|
||||||
|
}
|
||||||
|
while (($filename = readdir($dh)) !== false) {
|
||||||
|
if (in_array($filename, $aIgnore)) { continue; }
|
||||||
|
$subrelpath = sprintf('%s/%s', $path, $filename);
|
||||||
|
$subfullpath = sprintf('%s/%s', $fsPath, $subrelpath);
|
||||||
|
if (is_dir($subfullpath)) {
|
||||||
|
checkDirectory($subrelpath);
|
||||||
|
}
|
||||||
|
if (is_file($subfullpath)) {
|
||||||
|
checkFile($subrelpath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkRepoFolder($oFolder) {
|
||||||
|
global $fsPath, $aRepoFolderProblems;
|
||||||
|
$sFolderPath = sprintf('%s/%s', $oFolder->getFullPath(), $oFolder->getName());
|
||||||
|
$sFullPath = sprintf('%s/%s', $fsPath, $sFolderPath);
|
||||||
|
if (!is_dir($sFullPath)) {
|
||||||
|
$aRepoFolderProblems[] = $sFolderPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkRepoDocument($oDocument) {
|
||||||
|
global $fsPath, $aRepoDocumentProblems;
|
||||||
|
$sDocumentPath = $oDocument->getStoragePath();
|
||||||
|
$sFullPath = sprintf('%s/%s', $fsPath, $sDocumentPath);
|
||||||
|
if (!is_file($sFullPath)) {
|
||||||
|
$aRepoDocumentProblems[] = $sDocumentPath;
|
||||||
|
}
|
||||||
|
checkRepoVersions($oDocument);
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkRepoVersions($oDocument) {
|
||||||
|
global $fsPath, $aRepoVersionProblems;
|
||||||
|
$table = 'document_transactions';
|
||||||
|
$aVersions = DBUtil::getResultArrayKey(array("SELECT DISTINCT version FROM $table WHERE document_id = ?", array($oDocument->getID())), 'version');
|
||||||
|
foreach($aVersions as $sVersion) {
|
||||||
|
if ($sVersion == $oDocument->getVersion()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$sDocumentPath = $oDocument->getStoragePath();
|
||||||
|
$sFullPath = sprintf('%s/%s-%s', $fsPath, $sDocumentPath, $sVersion);
|
||||||
|
if (!is_file($sFullPath)) {
|
||||||
|
$aRepoVersionProblems[] = array($sDocumentPath, $sVersion);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
checkDirectory('');
|
||||||
|
|
||||||
|
print "\n";
|
||||||
|
print "Would remove these folders (and all their contents):\n";
|
||||||
|
foreach ($aFoldersToRemove as $path) {
|
||||||
|
print "\t$path\n";
|
||||||
|
}
|
||||||
|
print "\n";
|
||||||
|
print "Would remove these files:\n";
|
||||||
|
foreach ($aFilesToRemove as $path) {
|
||||||
|
print "\t$path\n";
|
||||||
|
}
|
||||||
|
print "\n";
|
||||||
|
|
||||||
|
$aFolders =& Folder::getList();
|
||||||
|
foreach ($aFolders as $oFolder) {
|
||||||
|
checkRepoFolder($oFolder);
|
||||||
|
}
|
||||||
|
|
||||||
|
print "These folders are not on the filesystem:\n";
|
||||||
|
foreach ($aRepoFolderProblems as $path) {
|
||||||
|
print "\t$path\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$aDocuments =& Document::getList(array('status_id = ?', array(LIVE)));
|
||||||
|
foreach ($aDocuments as $oDocument) {
|
||||||
|
checkRepoDocument($oDocument);
|
||||||
|
}
|
||||||
|
print "\n";
|
||||||
|
|
||||||
|
print "These documents are not on the filesystem:\n";
|
||||||
|
foreach ($aRepoDocumentProblems as $path) {
|
||||||
|
print "\t$path\n";
|
||||||
|
}
|
||||||
|
print "\n";
|
||||||
|
|
||||||
|
print "These documents have versions not on the filesystem:\n";
|
||||||
|
foreach ($aRepoVersionProblems as $path) {
|
||||||
|
list($path, $version) = $path;
|
||||||
|
print "\t$path - version $version\n";
|
||||||
|
}
|
||||||
|
print "\n";
|
||||||
|
|
||||||
58
bin/dbmaint.php
Normal file
58
bin/dbmaint.php
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once('../config/dmsDefaults.php');
|
||||||
|
|
||||||
|
$action = 'check';
|
||||||
|
$sqlaction = 'check table';
|
||||||
|
if ($argc > 0)
|
||||||
|
{
|
||||||
|
foreach($argv as $arg)
|
||||||
|
{
|
||||||
|
$action=strtolower($arg);
|
||||||
|
switch ($action)
|
||||||
|
{
|
||||||
|
case 'repair':
|
||||||
|
$sqlaction='repair table';
|
||||||
|
break;
|
||||||
|
case 'optimize':
|
||||||
|
$sqlaction='optimize table';
|
||||||
|
break;
|
||||||
|
case 'help':
|
||||||
|
print "Usage: dbmaint.php repair|check|optimize\n";
|
||||||
|
exit;
|
||||||
|
case 'check':
|
||||||
|
default:
|
||||||
|
$action = 'check';
|
||||||
|
$sqlaction='check table';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$default->log->info("DB Maintenance... \nAction selected: {$action}");
|
||||||
|
|
||||||
|
$sql = "show tables";
|
||||||
|
$tables = DBUtil::getResultArray($sql);
|
||||||
|
|
||||||
|
if(!empty($tables)){
|
||||||
|
foreach($tables as $table)
|
||||||
|
{
|
||||||
|
$key = array_keys($table);
|
||||||
|
|
||||||
|
$tablename=$table[$key[0]];
|
||||||
|
$sql = "$sqlaction $tablename;";
|
||||||
|
$result = DBUtil::getOneResult($sql);
|
||||||
|
|
||||||
|
if (PEAR::isError($result))
|
||||||
|
{
|
||||||
|
$default->log->error('Attempted: '.$sql);
|
||||||
|
$default->log->error(' *: '.$result->getMessage());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$default->log->info('Running: '.$sql .' - '. $result['Msg_text']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$default->log->info('Done.');
|
||||||
|
exit;
|
||||||
|
?>
|
||||||
1
bin/diagtools/ReportTemplate.html
Normal file
1
bin/diagtools/ReportTemplate.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0" style="border:1px solid #000066; background-color:#DADADE"><tr><td style="font-family:Arial, Helvetica, sans-serif; font-size:14px; font-weight:bold; padding:10px; border-bottom: 1px solid #666666">[heading]</td></tr><tr><td style="font-size:12px; background-color:#FFFFFF; padding:10px 5px 20px 5px;"><pre>[content]</pre></td></tr></table>
|
||||||
22
bin/diagtools/winDiag.php
Normal file
22
bin/diagtools/winDiag.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
$template=file_get_contents('ReportTemplate.html');
|
||||||
|
|
||||||
|
$rep=array();
|
||||||
|
$rep['running processes']=shell_exec('tasklist');
|
||||||
|
$rep['services']=shell_exec('sc query');
|
||||||
|
$rep['system path']=shell_exec('path');
|
||||||
|
$rep['environment variables']=shell_exec('set');
|
||||||
|
|
||||||
|
$report=array();
|
||||||
|
|
||||||
|
foreach ($rep as $test=>$results){
|
||||||
|
$test=ucwords($test);
|
||||||
|
$report[]=str_replace(array('[heading]','[content]'),array($test,$results),$template);
|
||||||
|
}
|
||||||
|
|
||||||
|
$report=join('',$report);
|
||||||
|
|
||||||
|
echo $report;
|
||||||
|
*/
|
||||||
|
?>
|
||||||
104
bin/expungeall.php
Normal file
104
bin/expungeall.php
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): ______________________________________
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once('../config/dmsDefaults.php');
|
||||||
|
require_once('../ktapi/ktapi.inc.php');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This script expects the following in the config.ini:
|
||||||
|
* [autoexpunge]
|
||||||
|
* admin=admin
|
||||||
|
* password=admin
|
||||||
|
* maximum=50
|
||||||
|
*
|
||||||
|
* admin and password is required to expunge documents from the system.
|
||||||
|
*
|
||||||
|
* maximum is the maximum number of documents that should be expunged from the system in one run.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
$start_time = time();
|
||||||
|
|
||||||
|
$config = KTConfig::getSingleton();
|
||||||
|
$user = $config->get('autoexpunge/admin','admin');
|
||||||
|
$password = $config->get('autoexpunge/password','admin');
|
||||||
|
$maximum = $config->get('autoexpunge/maximum',50);
|
||||||
|
|
||||||
|
$ktapi = new KTAPI();
|
||||||
|
$session = $ktapi->start_session($user, $password);
|
||||||
|
if (PEAR::isError($session))
|
||||||
|
{
|
||||||
|
$default->log->debug('Expunge_all task: Can\'t create session: '.$session->getMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = sprintf("SELECT id FROM documents WHERE status_id=%d LIMIT %d", DELETED, $maximum);
|
||||||
|
|
||||||
|
$rows = DBUtil::getResultArray($sql);
|
||||||
|
$count = count($rows);
|
||||||
|
|
||||||
|
if ($count == 0)
|
||||||
|
{
|
||||||
|
$default->log->debug('Expunge_all task: Nothing to do.');
|
||||||
|
$session->logout();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($rows as $row)
|
||||||
|
{
|
||||||
|
$id = $row['id'];
|
||||||
|
|
||||||
|
$document = $ktapi->get_document_by_id($id);
|
||||||
|
$title = $document->get_title();
|
||||||
|
|
||||||
|
$default->log->info('Expunge_all task: Document to expunge, ID: '.$id.' Name: '.$title);
|
||||||
|
$result = $document->expunge();
|
||||||
|
if (PEAR::isError($result))
|
||||||
|
{
|
||||||
|
$default->log->error('Expunge_all task: document can\'t be expunged: '.$result->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$end_time = time();
|
||||||
|
|
||||||
|
$diff = $end_time - $start_time;
|
||||||
|
|
||||||
|
$session->logout();
|
||||||
|
exit;
|
||||||
|
?>
|
||||||
49
bin/genpo.sh
Normal file
49
bin/genpo.sh
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
DIR=`dirname $0`
|
||||||
|
cd $DIR
|
||||||
|
cd ..
|
||||||
|
pwd
|
||||||
|
|
||||||
|
#pull in comm stuff
|
||||||
|
#cp -R ../commercial-plugins/alerts plugins/commercial/
|
||||||
|
#cp -R ../commercial-plugins/conditional-metadata plugins/commercial/
|
||||||
|
#cp -R ../commercial-plugins/custom-numbering plugins/commercial/
|
||||||
|
#cp -R ../commercial-plugins/documentcomparison plugins/commercial/
|
||||||
|
#cp -R ../commercial-plugins/network plugins/commercial/
|
||||||
|
#cp -R ../commercial-plugins/professional-reporting plugins/commercial/
|
||||||
|
#cp -R ../commercial-plugins/shortcuts plugins/commercial/
|
||||||
|
#cp -R ../commercial-plugins/wintools plugins/commercial/
|
||||||
|
#cp -R ../commercial-plugins/guidInserter plugins/commercial/
|
||||||
|
#cp -R ../commercial-plugins/clienttools plugins/commercial/
|
||||||
|
#cp -R ../commercial-plugins/electronic-signatures plugins/commercial/
|
||||||
|
#cp -R ../commercial-plugins/officeaddin plugins/commercial/
|
||||||
|
#cp -R ../ktofficeAddIn/ktoffice ktoffice
|
||||||
|
|
||||||
|
cp -R ../commercial-plugins plugins/commercial
|
||||||
|
cp -R ../ktofficeaddin/ktoffice ktoffice
|
||||||
|
|
||||||
|
rm -f i18n/templates.c
|
||||||
|
find resources -name "*.js" | sort | python ./bin/jsi18n.py > templates/ktcore/javascript_i18n.smarty
|
||||||
|
php bin/smarty_to_gettext.php . > i18n/templates.c
|
||||||
|
find . -type f -name "*.php" -o -name "*.inc" | sort | xgettext --no-wrap -d knowledgeTree -L PHP -s -f - --keyword=_kt -o i18n/knowledgeTree.pot
|
||||||
|
echo i18n/templates.c i18n/transactions.c i18n/permissions.c | xargs -n 1 | sort | xgettext --no-wrap -d knowledgeTree -j -s -f - -o i18n/knowledgeTree.pot
|
||||||
|
|
||||||
|
# ktoffice js tamplate file generation
|
||||||
|
cd ktoffice/pogenerator
|
||||||
|
php generatetemplate.php > ../../templates/ktcore/ktoffice_i18n.smarty
|
||||||
|
cd ../../
|
||||||
|
|
||||||
|
#remove comm stuff again
|
||||||
|
rm -rf plugins/commercial
|
||||||
|
rm -rf ktoffice
|
||||||
|
|
||||||
|
#alerts conditional-metadata custom-numbering documentcomparison i18n network professional-reporting shortcuts wintools guidInserter clienttools electronic-signatures officeaddin
|
||||||
|
|
||||||
|
# Manually append some strings with #appname# issues
|
||||||
|
echo ' ' >> i18n/knowledgeTree.pot
|
||||||
|
echo 'msgid "By default, KnowledgeTree controls its own users and groups and stores all information about them inside the database. In many situations, an organisation will already have a list of users and groups, and needs to use that existing information to allow access to the DMS. These <strong>Authentication Sources</strong> allow the system administrator to specify additional sources of authentication data."' >> i18n/knowledgeTree.pot
|
||||||
|
echo 'msgstr ""' >> i18n/knowledgeTree.pot
|
||||||
|
|
||||||
|
echo 'msgid "This report lists all mime types and extensions that can be identified by KnowledgeTree."' >> i18n/knowledgeTree.pot
|
||||||
|
echo 'msgstr ""' >> i18n/knowledgeTree.pot
|
||||||
65
bin/jsi18n.py
Normal file
65
bin/jsi18n.py
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
#
|
||||||
|
# JS Gettext-style extractor.
|
||||||
|
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
usage_str = '''
|
||||||
|
Extracts _() items in JS.
|
||||||
|
|
||||||
|
Usage: jsi18n.py [list of files] > output.smarty
|
||||||
|
'''
|
||||||
|
|
||||||
|
baseline = '''
|
||||||
|
/*
|
||||||
|
* Javascript (actual translations);
|
||||||
|
*/
|
||||||
|
|
||||||
|
{literal}
|
||||||
|
var i18n = {};
|
||||||
|
|
||||||
|
function _(trans_string) {
|
||||||
|
var newstr = i18n[trans_string];
|
||||||
|
if (!isUndefinedOrNull(newstr)) { return newstr; }
|
||||||
|
else {
|
||||||
|
return trans_string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{/literal}
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
peritem = "i18n['%s'] = '{i18n}%s{/i18n}';\n"
|
||||||
|
|
||||||
|
# this is not the best way to do this ...
|
||||||
|
|
||||||
|
class JSExtractor:
|
||||||
|
def __init__(self, filename):
|
||||||
|
self.strings = []
|
||||||
|
handle = file(filename, 'r')
|
||||||
|
self.content = handle.read()
|
||||||
|
handle.close()
|
||||||
|
|
||||||
|
def process(self):
|
||||||
|
proc = re.compile('(_\(\'(.*?)\'\))')
|
||||||
|
self.strings = [i[1] for i in proc.findall(self.content)]
|
||||||
|
|
||||||
|
def getStrings(self):
|
||||||
|
out = ''
|
||||||
|
for l in self.strings:
|
||||||
|
out += peritem%(l, l)
|
||||||
|
return out
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
fake_po = baseline
|
||||||
|
|
||||||
|
filelist = sys.stdin.readlines()
|
||||||
|
for filename in filelist:
|
||||||
|
processor = JSExtractor(filename[:-1])
|
||||||
|
processor.process()
|
||||||
|
fake_po += "\n// strings for file: %s\n"%(filename[:-1]);
|
||||||
|
fake_po += processor.getStrings()
|
||||||
|
|
||||||
|
print fake_po
|
||||||
BIN
bin/luceneserver/KTLuceneService.exe
Normal file
BIN
bin/luceneserver/KTLuceneService.exe
Normal file
Binary file not shown.
9
bin/luceneserver/KnowledgeTreeIndexer.Logging.properties
Normal file
9
bin/luceneserver/KnowledgeTreeIndexer.Logging.properties
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Set root logger level to DEBUG and its only appender to A1.
|
||||||
|
log4j.rootLogger=INFO, A1
|
||||||
|
|
||||||
|
# A1 is set to be a ConsoleAppender.
|
||||||
|
log4j.appender.A1=org.apache.log4j.ConsoleAppender
|
||||||
|
|
||||||
|
# A1 uses PatternLayout.
|
||||||
|
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
|
||||||
6
bin/luceneserver/KnowledgeTreeIndexer.properties
Normal file
6
bin/luceneserver/KnowledgeTreeIndexer.properties
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
server.port=8875
|
||||||
|
server.paranoid=false
|
||||||
|
server.accept=127.0.0.1
|
||||||
|
server.deny=
|
||||||
|
indexer.directory=/var/lib/knowledgetree-ce/indexes
|
||||||
|
indexer.analyzer=org.apache.lucene.analysis.standard.StandardAnalyzer
|
||||||
87
bin/luceneserver/README.TXT
Normal file
87
bin/luceneserver/README.TXT
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
Lucene XML-RPC Server
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
Prerequisites
|
||||||
|
=============
|
||||||
|
|
||||||
|
This requires Java 1.5+ to be installed.
|
||||||
|
|
||||||
|
|
||||||
|
Starting the Lucene Server Manually
|
||||||
|
===================================
|
||||||
|
|
||||||
|
cd c:\program files\ktdms\knowledgeTree\bin\luceneserver
|
||||||
|
;cd /opt/ktdms/knowledgeTree/bin/luceneserver
|
||||||
|
java -jar ktlucene.jar
|
||||||
|
|
||||||
|
Starting the Lucene Server in the background under Windows
|
||||||
|
==========================================================
|
||||||
|
|
||||||
|
The best is to install a service wrapper application called JavaService. This can be obtained from http://forge.objectweb.org/projects/javaservice/ and is licensed under LGPL.
|
||||||
|
|
||||||
|
Rename JavaService.exe to KTLuceneService.exe and place it in the KTLUCENEDIR folder.
|
||||||
|
|
||||||
|
To install the service:
|
||||||
|
; you may need to edit the JVMLIB. note - there is also bin\client\jvm.dll sometimes.
|
||||||
|
SET JVMLIB=c:\j2sdk\jre\bin\server\jvm.dll
|
||||||
|
SET KTLUCENEDIR=c:\program files\ktdms\knowledgeTree\bin\luceneserver
|
||||||
|
SET KTLUCENECLASS=%PROXYDIR%\ktlucene.jar
|
||||||
|
SET OUTFILE=%KTLUCENEDIR%\out.txt
|
||||||
|
SET ERRFILE=%KTLUCENEDIR%\err.txt
|
||||||
|
KTLuceneService.exe -install "KTLuceneService" %JVMLIB% -Djava.class.path=%KTLUCENECLASS% -start KTLuceneService -auto -out %OUTFILE% -err %ERRFILE%
|
||||||
|
|
||||||
|
|
||||||
|
To uninstall the service:
|
||||||
|
KTLuceneService -uninstall "KTLuceneService"
|
||||||
|
|
||||||
|
Starting the Lucene Service in the background under Linux/Unix
|
||||||
|
==============================================================
|
||||||
|
|
||||||
|
cd c:\program files\ktdms\knowledgeTree\bin\luceneserver
|
||||||
|
;cd /opt/ktdms/knowledgeTree/bin/luceneserver
|
||||||
|
nohup java -jar ktlucene.jar 2>&1 &
|
||||||
|
|
||||||
|
|
||||||
|
KnowledgeTreeIndexer.Logging.properties
|
||||||
|
=======================================
|
||||||
|
|
||||||
|
The Lucene server uses log4j as the logging library. More information regarding
|
||||||
|
configuration may be obtained from http://www.apache.org
|
||||||
|
|
||||||
|
To enable debugging, change
|
||||||
|
log4j.rootLogger=INFO, A1
|
||||||
|
to
|
||||||
|
log4j.rootLogger=DEBUG, A1
|
||||||
|
|
||||||
|
|
||||||
|
TODO... discuss logrotation with log4j.
|
||||||
|
|
||||||
|
|
||||||
|
KnowledgeTreeIndexer.properties
|
||||||
|
===============================
|
||||||
|
|
||||||
|
; specifies the port on which the system will listen for requests
|
||||||
|
server.port=8080
|
||||||
|
; if paranoid, only 'acceptable ip addresses will be able to make requests.
|
||||||
|
server.paranoid=false
|
||||||
|
; the list of acceptable ip addresses
|
||||||
|
server.accept=127.0.0.1,192.168.1.1
|
||||||
|
; the folder where the lucene server will store the indexes
|
||||||
|
indexer.directory=../../var/indexes
|
||||||
|
|
||||||
|
Licensing
|
||||||
|
=========
|
||||||
|
|
||||||
|
The Java based KnowledgeTree XML-RPC Server utilises the following jar files:
|
||||||
|
|
||||||
|
commons-lang-2.3.jar - Apache License
|
||||||
|
log4j-1.2.14.jar - Apache License
|
||||||
|
lucene-core-2.1.0.jar - Apache License
|
||||||
|
lucene-highlighter-2.1.0.jar - Apache License
|
||||||
|
NTEventLogAppender.dll - Apache License
|
||||||
|
commons-logging-1.1.jar - Apache License
|
||||||
|
ws-commons-util-1.0.1.jar - Apache License
|
||||||
|
xmlrpc-common-3.0.jar - Apache License
|
||||||
|
xmlrpc-server-3.0.jar - Apache License
|
||||||
|
|
||||||
|
For more information, visit http://www.apache.org
|
||||||
BIN
bin/luceneserver/ktlucene.jar
Normal file
BIN
bin/luceneserver/ktlucene.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/NTEventLogAppender.dll
Normal file
BIN
bin/luceneserver/lib/NTEventLogAppender.dll
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/asm-3.1.jar
Normal file
BIN
bin/luceneserver/lib/asm-3.1.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/commons-codec-1.3.jar
Normal file
BIN
bin/luceneserver/lib/commons-codec-1.3.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/commons-io-1.4.jar
Normal file
BIN
bin/luceneserver/lib/commons-io-1.4.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/commons-lang-2.3.jar
Normal file
BIN
bin/luceneserver/lib/commons-lang-2.3.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/commons-logging-1.1.jar
Normal file
BIN
bin/luceneserver/lib/commons-logging-1.1.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/fontbox-0.1.0.jar
Normal file
BIN
bin/luceneserver/lib/fontbox-0.1.0.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/icu4j-3.4.4.jar
Normal file
BIN
bin/luceneserver/lib/icu4j-3.4.4.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/java_uno.jar
Normal file
BIN
bin/luceneserver/lib/java_uno.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/jodconverter-2.2.2.jar
Normal file
BIN
bin/luceneserver/lib/jodconverter-2.2.2.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/juh-3.0.1.jar
Normal file
BIN
bin/luceneserver/lib/juh-3.0.1.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/junit-3.8.1.jar
Normal file
BIN
bin/luceneserver/lib/junit-3.8.1.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/jurt-3.0.1.jar
Normal file
BIN
bin/luceneserver/lib/jurt-3.0.1.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/log4j-1.2.14.jar
Normal file
BIN
bin/luceneserver/lib/log4j-1.2.14.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/lucene-core-2.1.0.jar
Normal file
BIN
bin/luceneserver/lib/lucene-core-2.1.0.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/lucene-highlighter-2.1.0.jar
Normal file
BIN
bin/luceneserver/lib/lucene-highlighter-2.1.0.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/nekohtml-0.9.5.jar
Normal file
BIN
bin/luceneserver/lib/nekohtml-0.9.5.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/ooxml-lib/dom4j-1.6.1.jar
Normal file
BIN
bin/luceneserver/lib/ooxml-lib/dom4j-1.6.1.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/ooxml-lib/jaxen-1.1.jar
Normal file
BIN
bin/luceneserver/lib/ooxml-lib/jaxen-1.1.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/ooxml-lib/jsr173_1.0_api.jar
Normal file
BIN
bin/luceneserver/lib/ooxml-lib/jsr173_1.0_api.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/ooxml-lib/ooxml-schemas.jar
Normal file
BIN
bin/luceneserver/lib/ooxml-lib/ooxml-schemas.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/ooxml-lib/openxml4j-bin-alpha-080407.jar
Normal file
BIN
bin/luceneserver/lib/ooxml-lib/openxml4j-bin-alpha-080407.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/ooxml-lib/openxml4j-bin-beta-080728.jar
Normal file
BIN
bin/luceneserver/lib/ooxml-lib/openxml4j-bin-beta-080728.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/ooxml-lib/openxml4j-src-alpha-080407.jar
Normal file
BIN
bin/luceneserver/lib/ooxml-lib/openxml4j-src-alpha-080407.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/ooxml-lib/xercesImpl-2.8.1.jar
Normal file
BIN
bin/luceneserver/lib/ooxml-lib/xercesImpl-2.8.1.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/ooxml-lib/xmlbeans-2.3.0.jar
Normal file
BIN
bin/luceneserver/lib/ooxml-lib/xmlbeans-2.3.0.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/pdfbox-0.7.3.jar
Normal file
BIN
bin/luceneserver/lib/pdfbox-0.7.3.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/poi-3.5-beta5/poi-3.5-beta5.jar
Normal file
BIN
bin/luceneserver/lib/poi-3.5-beta5/poi-3.5-beta5.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/poi-3.5-beta5/poi-contrib-3.5-beta5.jar
Normal file
BIN
bin/luceneserver/lib/poi-3.5-beta5/poi-contrib-3.5-beta5.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/poi-3.5-beta5/poi-ooxml-3.5-beta5.jar
Normal file
BIN
bin/luceneserver/lib/poi-3.5-beta5/poi-ooxml-3.5-beta5.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/poi-3.5-beta5/poi-scratchpad-3.5-beta5.jar
Normal file
BIN
bin/luceneserver/lib/poi-3.5-beta5/poi-scratchpad-3.5-beta5.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/ridl-3.0.1.jar
Normal file
BIN
bin/luceneserver/lib/ridl-3.0.1.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/slf4j-api-1.5.6.jar
Normal file
BIN
bin/luceneserver/lib/slf4j-api-1.5.6.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/slf4j-jdk14-1.5.6.jar
Normal file
BIN
bin/luceneserver/lib/slf4j-jdk14-1.5.6.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/tika-app-0.4.jar
Normal file
BIN
bin/luceneserver/lib/tika-app-0.4.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/unoil-3.0.1.jar
Normal file
BIN
bin/luceneserver/lib/unoil-3.0.1.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/unoloader.jar
Normal file
BIN
bin/luceneserver/lib/unoloader.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/ws-commons-util-1.0.1.jar
Normal file
BIN
bin/luceneserver/lib/ws-commons-util-1.0.1.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/xmlrpc-common-3.0.jar
Normal file
BIN
bin/luceneserver/lib/xmlrpc-common-3.0.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/xmlrpc-server-3.0.jar
Normal file
BIN
bin/luceneserver/lib/xmlrpc-server-3.0.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/lib/xstream-1.3.1.jar
Normal file
BIN
bin/luceneserver/lib/xstream-1.3.1.jar
Normal file
Binary file not shown.
BIN
bin/luceneserver/msvcr71.dll
Normal file
BIN
bin/luceneserver/msvcr71.dll
Normal file
Binary file not shown.
149
bin/md5_validation.php
Normal file
149
bin/md5_validation.php
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* $Id: $
|
||||||
|
*
|
||||||
|
* Base class for database-backed objects
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): ______________________________________
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once('../config/dmsDefaults.php');
|
||||||
|
|
||||||
|
print "KnowledgeTree MD5 Validation Tool\n";
|
||||||
|
print "=================================\n\n";
|
||||||
|
print "NOTE: This utility make take some time to run to completion!\n\n";
|
||||||
|
|
||||||
|
$sql = "SELECT
|
||||||
|
dcv.id, dmv.document_id, MAX(dmv.id) AS metadata_version_id, MAX(dmv.metadata_version) AS metadata_version
|
||||||
|
FROM
|
||||||
|
document_content_version AS dcv
|
||||||
|
INNER JOIN document_metadata_version AS dmv ON dcv.id = dmv.content_version_id
|
||||||
|
GROUP BY
|
||||||
|
dcv.id
|
||||||
|
ORDER BY dcv.document_id";
|
||||||
|
|
||||||
|
$rows = DBUtil::getResultArray(array($sql));
|
||||||
|
|
||||||
|
$total = count($rows);
|
||||||
|
$problem = 0;
|
||||||
|
$ok = 0;
|
||||||
|
$no_hash = 0;
|
||||||
|
$current = 0;
|
||||||
|
$dots = 0;
|
||||||
|
|
||||||
|
foreach($rows as $row)
|
||||||
|
{
|
||||||
|
if (++$current % 100 == 0)
|
||||||
|
{
|
||||||
|
print '.';
|
||||||
|
if ($dots++ % 60 == 0)
|
||||||
|
{
|
||||||
|
print "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$content_id = $row['id'];
|
||||||
|
$document_id = $row['document_id'];
|
||||||
|
$metadata_version = $row['metadata_version'];
|
||||||
|
$metadata_version_id = $row['metadata_version_id'];
|
||||||
|
|
||||||
|
$document = Document::get($document_id, $metadata_version_id);
|
||||||
|
$core = &$document->_oDocumentContentVersion;
|
||||||
|
|
||||||
|
$filename = $document->getFileName();
|
||||||
|
$md5 = $core->getStorageHash();
|
||||||
|
|
||||||
|
if (empty($md5))
|
||||||
|
{
|
||||||
|
if ($dots > 0) print "\n";
|
||||||
|
print("Document Id: $document_id - Content Id: $content_id - No MD5 hash available.\n");
|
||||||
|
|
||||||
|
$no_hash++;
|
||||||
|
$current = 0; $dots = 0;
|
||||||
|
// don't exit here, we do so later
|
||||||
|
}
|
||||||
|
|
||||||
|
$storage = KTStorageManagerUtil::getSingleton();
|
||||||
|
$storage_path = $storage->temporaryFile($document);
|
||||||
|
if (PEAR::isError($storage_path))
|
||||||
|
{
|
||||||
|
if ($dots > 0) print "\n";
|
||||||
|
print("Document Id: $document_id - Content Id: $content_id - Storage engine reported an error: " . $storage_path->getMessage() . "\n");
|
||||||
|
|
||||||
|
$no_hash++;
|
||||||
|
$current = 0; $dots = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!file_exists($storage_path))
|
||||||
|
{
|
||||||
|
if ($dots > 0) print "\n";
|
||||||
|
print("Document Id: $document_id - Content Id: $content_id - File '$storage_path' cannot be found!\n");
|
||||||
|
|
||||||
|
$no_hash++;
|
||||||
|
$current = 0; $dots = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$actual_md5 = md5_file($storage_path);
|
||||||
|
|
||||||
|
$storage->freeTemporaryFile($storage_path);
|
||||||
|
|
||||||
|
if (empty($md5))
|
||||||
|
{
|
||||||
|
$core->setStorageHash($actual_md5);
|
||||||
|
$core->update();
|
||||||
|
print("\tHash set to: $actual_md5\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($md5 != $actual_md5)
|
||||||
|
{
|
||||||
|
if ($dots > 0) print "\n";
|
||||||
|
print("Document Id: $document_id - Content ID: $content_id - MD5 difference\n");
|
||||||
|
print("\tStored MD5: $md5\n");
|
||||||
|
print("\tCurrent MD5: $actual_md5\n");
|
||||||
|
$problem++;
|
||||||
|
$current = 0; $dots = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$ok++;
|
||||||
|
}
|
||||||
|
|
||||||
|
print("\nStatistics:\n");
|
||||||
|
print("\tNo Problem:\t$ok\n");
|
||||||
|
print("\tProblem:\t$problem\n");
|
||||||
|
print("\tNo Hash:\t$no_hash\n");
|
||||||
|
print("\tTotal:\t\t$total\n");
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
162
bin/openoffice/DocumentConverter.py
Normal file
162
bin/openoffice/DocumentConverter.py
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
#
|
||||||
|
# PyODConverter (Python OpenDocument Converter) v0.9 - 2007-04-05
|
||||||
|
#
|
||||||
|
# This script converts a document from one office format to another by
|
||||||
|
# connecting to an OpenOffice.org instance via Python-UNO bridge.
|
||||||
|
#
|
||||||
|
# Copyright (C) 2007 Mirko Nasato <mirko@artofsolving.com>
|
||||||
|
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
|
||||||
|
#
|
||||||
|
# Modified by Kevin Fourie <kevin@knowledgetree.com>
|
||||||
|
# Contributions by Xavier Duret, Conrad Vermeulen
|
||||||
|
|
||||||
|
#DEFAULT_OPENOFFICE_PORT = 8100
|
||||||
|
|
||||||
|
import os, sys, glob
|
||||||
|
|
||||||
|
extrapaths = glob.glob('/usr/lib*/openoffice*/program/') + glob.glob('/usr/lib*/ooo*/program') + [ '/Applications/NeoOffice.app/Contents/program', 'c:/program files/ktdms/openoffice/program' ]
|
||||||
|
|
||||||
|
ooProgramPath = os.environ.get('ooProgramPath')
|
||||||
|
if not ooProgramPath is None:
|
||||||
|
extrapaths = [ ooProgramPath ] + extrapaths
|
||||||
|
|
||||||
|
for path in extrapaths:
|
||||||
|
try:
|
||||||
|
sys.path.append(path)
|
||||||
|
import uno
|
||||||
|
os.environ['PATH'] = '%s:' % path + os.environ['PATH']
|
||||||
|
break
|
||||||
|
except ImportError:
|
||||||
|
sys.path.remove(path)
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
print >>sys.stderr, "PyODConverter: Cannot find the pyuno.so library in sys.path and known paths."
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
from os.path import abspath, splitext
|
||||||
|
from com.sun.star.beans import PropertyValue
|
||||||
|
from com.sun.star.connection import NoConnectException
|
||||||
|
|
||||||
|
FAMILY_PRESENTATION = "Presentation"
|
||||||
|
FAMILY_SPREADSHEET = "Spreadsheet"
|
||||||
|
FAMILY_TEXT = "Text"
|
||||||
|
|
||||||
|
FAMILY_BY_EXTENSION = {
|
||||||
|
"odt": FAMILY_TEXT,
|
||||||
|
"sxw": FAMILY_TEXT,
|
||||||
|
"doc": FAMILY_TEXT,
|
||||||
|
"rtf": FAMILY_TEXT,
|
||||||
|
"txt": FAMILY_TEXT,
|
||||||
|
"wpd": FAMILY_TEXT,
|
||||||
|
"html": FAMILY_TEXT,
|
||||||
|
"ods": FAMILY_SPREADSHEET,
|
||||||
|
"sxc": FAMILY_SPREADSHEET,
|
||||||
|
"xls": FAMILY_SPREADSHEET,
|
||||||
|
"odp": FAMILY_PRESENTATION,
|
||||||
|
"sxi": FAMILY_PRESENTATION,
|
||||||
|
"ppt": FAMILY_PRESENTATION
|
||||||
|
}
|
||||||
|
|
||||||
|
FILTER_BY_EXTENSION = {
|
||||||
|
"pdf": {
|
||||||
|
FAMILY_TEXT: "writer_pdf_Export",
|
||||||
|
FAMILY_SPREADSHEET: "calc_pdf_Export",
|
||||||
|
FAMILY_PRESENTATION: "impress_pdf_Export"
|
||||||
|
},
|
||||||
|
"html": {
|
||||||
|
FAMILY_TEXT: "HTML (StarWriter)",
|
||||||
|
FAMILY_SPREADSHEET: "HTML (StarCalc)",
|
||||||
|
FAMILY_PRESENTATION: "impress_html_Export"
|
||||||
|
},
|
||||||
|
"odt": { FAMILY_TEXT: "writer8" },
|
||||||
|
"doc": { FAMILY_TEXT: "MS Word 97" },
|
||||||
|
"rtf": { FAMILY_TEXT: "Rich Text Format" },
|
||||||
|
"txt": { FAMILY_TEXT: "Text" },
|
||||||
|
"ods": { FAMILY_SPREADSHEET: "calc8" },
|
||||||
|
"xls": { FAMILY_SPREADSHEET: "MS Excel 97" },
|
||||||
|
"odp": { FAMILY_PRESENTATION: "impress8" },
|
||||||
|
"ppt": { FAMILY_PRESENTATION: "MS PowerPoint 97" },
|
||||||
|
"swf": { FAMILY_PRESENTATION: "impress_flash_Export" }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class DocumentConversionException(Exception):
|
||||||
|
|
||||||
|
def __init__(self, message):
|
||||||
|
self.message = message
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.message
|
||||||
|
|
||||||
|
|
||||||
|
def _unoProps(**args):
|
||||||
|
props = []
|
||||||
|
for key in args:
|
||||||
|
prop = PropertyValue()
|
||||||
|
prop.Name = key
|
||||||
|
prop.Value = args[key]
|
||||||
|
props.append(prop)
|
||||||
|
return tuple(props)
|
||||||
|
|
||||||
|
|
||||||
|
class DocumentConverter:
|
||||||
|
|
||||||
|
def __init__(self, host, port):
|
||||||
|
localContext = uno.getComponentContext()
|
||||||
|
resolver = localContext.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", localContext)
|
||||||
|
try:
|
||||||
|
context = resolver.resolve("uno:socket,host=%s,port=%s;urp;StarOffice.ComponentContext" % (host, port))
|
||||||
|
except NoConnectException:
|
||||||
|
raise DocumentConversionException, "failed to connect to OpenOffice.org on port %s" % port
|
||||||
|
self.desktop = context.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", context)
|
||||||
|
|
||||||
|
def convert(self, inputFile, outputFile):
|
||||||
|
inputExt = self._fileExt(inputFile)
|
||||||
|
outputExt = self._fileExt(outputFile)
|
||||||
|
|
||||||
|
filterName = self._filterName(inputExt, outputExt)
|
||||||
|
|
||||||
|
inputUrl = self._fileUrl(argv[1])
|
||||||
|
outputUrl = self._fileUrl(argv[2])
|
||||||
|
|
||||||
|
document = self.desktop.loadComponentFromURL(inputUrl, "_blank", 0, _unoProps(Hidden=True, ReadOnly=True))
|
||||||
|
document.storeToURL(outputUrl, _unoProps(FilterName=filterName))
|
||||||
|
document.close(True)
|
||||||
|
|
||||||
|
def _filterName(self, inputExt, outputExt):
|
||||||
|
try:
|
||||||
|
family = FAMILY_BY_EXTENSION[inputExt]
|
||||||
|
except KeyError:
|
||||||
|
raise DocumentConversionException, "unknown input format: '%s'" % inputExt
|
||||||
|
try:
|
||||||
|
filterByFamily = FILTER_BY_EXTENSION[outputExt]
|
||||||
|
except KeyError:
|
||||||
|
raise DocumentConversionException, "unknown output format: '%s'" % outputExt
|
||||||
|
try:
|
||||||
|
return filterByFamily[family]
|
||||||
|
except KeyError:
|
||||||
|
raise DocumentConversionException, "unsupported conversion: from '%s' to '%s'" % (inputExt, outputExt)
|
||||||
|
|
||||||
|
def _fileExt(self, path):
|
||||||
|
ext = splitext(path)[1]
|
||||||
|
if ext is not None:
|
||||||
|
return ext[1:].lower()
|
||||||
|
|
||||||
|
def _fileUrl(self, path):
|
||||||
|
return uno.systemPathToFileUrl(abspath(path))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
from sys import argv, exit
|
||||||
|
|
||||||
|
if len(argv) < 3:
|
||||||
|
print "USAGE: " + argv[0] + " <input-file> <output-file> <host> <port>"
|
||||||
|
exit(255)
|
||||||
|
|
||||||
|
try:
|
||||||
|
converter = DocumentConverter(argv[3],argv[4])
|
||||||
|
converter.convert(argv[1], argv[2])
|
||||||
|
except DocumentConversionException, exception:
|
||||||
|
print "ERROR! " + str(exception)
|
||||||
|
exit(1)
|
||||||
|
|
||||||
133
bin/openoffice/pdfgen.py
Normal file
133
bin/openoffice/pdfgen.py
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
#
|
||||||
|
# $Id$
|
||||||
|
#
|
||||||
|
# KnowledgeTree Community Edition
|
||||||
|
# Document Management Made Simple
|
||||||
|
# Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
# logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
# must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
# copyright notice.
|
||||||
|
# Contributor( s): ______________________________________
|
||||||
|
#
|
||||||
|
|
||||||
|
import os, sys, glob
|
||||||
|
|
||||||
|
extrapaths = glob.glob('/usr/lib*/openoffice*/program/') + glob.glob('/usr/lib*/ooo*/program') + [ '/Applications/NeoOffice.app/Contents/program', 'c:/program files/ktdms/openoffice/program' ]
|
||||||
|
|
||||||
|
ooProgramPath = os.environ.get('ooProgramPath')
|
||||||
|
if not ooProgramPath is None:
|
||||||
|
extrapaths = [ ooProgramPath ] + extrapaths
|
||||||
|
|
||||||
|
for path in extrapaths:
|
||||||
|
try:
|
||||||
|
sys.path.append(path)
|
||||||
|
import uno
|
||||||
|
os.environ['PATH'] = '%s:' % path + os.environ['PATH']
|
||||||
|
break
|
||||||
|
except ImportError:
|
||||||
|
sys.path.remove(path)
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
print >>sys.stderr, "PyODConverter: Cannot find the pyuno.so library in sys.path and known paths."
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
from com.sun.star.beans import PropertyValue
|
||||||
|
|
||||||
|
NoConnectException = uno.getClass("com.sun.star.connection.NoConnectException")
|
||||||
|
IllegalArgumentException = uno.getClass("com.sun.star.lang.IllegalArgumentException")
|
||||||
|
RuntimeException = uno.getClass("com.sun.star.uno.RuntimeException")
|
||||||
|
IOException = uno.getClass("com.sun.star.io.IOException")
|
||||||
|
|
||||||
|
url_original = uno.systemPathToFileUrl(sys.argv[1])
|
||||||
|
url_save = uno.systemPathToFileUrl(sys.argv[2])
|
||||||
|
|
||||||
|
try:
|
||||||
|
### Get Service Manager
|
||||||
|
context = uno.getComponentContext()
|
||||||
|
resolver = context.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", context)
|
||||||
|
ctx = resolver.resolve("uno:socket,host=localhost,port=8100;urp;StarOffice.ComponentContext")
|
||||||
|
smgr = ctx.ServiceManager
|
||||||
|
|
||||||
|
### Load document
|
||||||
|
properties = []
|
||||||
|
p = PropertyValue()
|
||||||
|
p.Name = "Hidden"
|
||||||
|
p.Value = True
|
||||||
|
properties.append(p)
|
||||||
|
properties = tuple(properties)
|
||||||
|
|
||||||
|
desktop = smgr.createInstanceWithContext("com.sun.star.frame.Desktop", ctx)
|
||||||
|
|
||||||
|
except NoConnectException, e:
|
||||||
|
sys.stderr.write("OpenOffice process not found or not listening (" + e.Message + ")\n")
|
||||||
|
sys.exit(1)
|
||||||
|
except IllegalArgumentException, e:
|
||||||
|
sys.stderr.write("The url is invalid ( " + e.Message + ")\n")
|
||||||
|
sys.exit(1)
|
||||||
|
except RuntimeException, e:
|
||||||
|
sys.stderr.write("An unknown error occured: " + e.Message + "\n")
|
||||||
|
|
||||||
|
try:
|
||||||
|
doc = desktop.loadComponentFromURL(url_original, "_blank", 0, properties)
|
||||||
|
except IOException, e:
|
||||||
|
sys.stderr.write("URL couldn't be found or was corrupt (" + e.Message + ")\n")
|
||||||
|
sys.exit(1)
|
||||||
|
except IllegalArgumentException, e:
|
||||||
|
sys.stderr.write("Given parameters don't conform to the specification ( " + e.Message + ")\n")
|
||||||
|
sys.exit(1)
|
||||||
|
except RuntimeException, e:
|
||||||
|
sys.stderr.write("An unknown error occured: " + e.Message + "\n")
|
||||||
|
|
||||||
|
if doc == None:
|
||||||
|
sys.stderr.write("The document could not be opened for conversion. This could indicate an unsupported mimetype.\n")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
### Save File
|
||||||
|
properties = []
|
||||||
|
p = PropertyValue()
|
||||||
|
p.Name = "Overwrite"
|
||||||
|
p.Value = True
|
||||||
|
properties.append(p)
|
||||||
|
p = PropertyValue()
|
||||||
|
p.Name = "FilterName"
|
||||||
|
p.Value = 'writer_pdf_Export'
|
||||||
|
properties.append(p)
|
||||||
|
properties = tuple(properties)
|
||||||
|
|
||||||
|
try:
|
||||||
|
doc.storeToURL(url_save, properties)
|
||||||
|
doc.dispose()
|
||||||
|
except IOException, e:
|
||||||
|
sys.stderr.write("URL (" + url_save + ") couldn't be found or was corrupt (" + e.Message + ")\n")
|
||||||
|
sys.exit(1)
|
||||||
|
except IllegalArgumentException, e:
|
||||||
|
sys.stderr.write("Given parameters don't conform to the specification ( " + e.Message + ")\n")
|
||||||
|
sys.exit(1)
|
||||||
|
except RuntimeException, e:
|
||||||
|
sys.stderr.write("An unknown error occured: " + e.Message + "\n")
|
||||||
63
bin/recreateIndexes.php
Normal file
63
bin/recreateIndexes.php
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): ______________________________________
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* PURPOSE: This script will recreate the indexes on the database. It will also attempt to add foreign key constraints.
|
||||||
|
*
|
||||||
|
* It will produce 'errors' when there are issues. Many may be ignored as some do not apply to open source.
|
||||||
|
*/
|
||||||
|
|
||||||
|
define('USE_DB_ADMIN_USER',1);
|
||||||
|
chdir(dirname(__FILE__));
|
||||||
|
require_once('../config/dmsDefaults.php');
|
||||||
|
require_once(KT_LIB_DIR . '/database/schema.inc.php');
|
||||||
|
|
||||||
|
print _kt('Recreate DB Indexes') . "...\n\n";
|
||||||
|
|
||||||
|
ini_set('display_errors','Off');
|
||||||
|
$schemautil = KTSchemaUtil::getSingleton();
|
||||||
|
|
||||||
|
$schemautil->dropForeignKeys();
|
||||||
|
$schemautil->dropPrimaryKeys();
|
||||||
|
$schemautil->dropIndexes();
|
||||||
|
$schemautil->createPrimaryKeys();
|
||||||
|
$schemautil->createForeignKeys();
|
||||||
|
$schemautil->createIndexes();
|
||||||
|
|
||||||
|
?>
|
||||||
73
bin/releaseKT.sh
Normal file
73
bin/releaseKT.sh
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# script to checkout the latest tagged build from cvs and upload
|
||||||
|
# to the remote server of your choice
|
||||||
|
|
||||||
|
## functions
|
||||||
|
|
||||||
|
# displays the script usage message
|
||||||
|
#
|
||||||
|
usage() {
|
||||||
|
echo "usage: `basename $0` -b branch -v version"
|
||||||
|
echo " eg. `basename $0` -b BRANCH_1_0_1_20030728 -v 1.1.2"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
deploy() {
|
||||||
|
# cleanup
|
||||||
|
rm -rf $tmp 2> /dev/null
|
||||||
|
mkdir $tmp
|
||||||
|
|
||||||
|
# export kt
|
||||||
|
cd $tmp
|
||||||
|
cvs -d $cvsroot co -r $branch -N knowledgeTree
|
||||||
|
cvs -d $cvsroot co -r $branch -N "knowledgeTree/Documents/Root Folder/Default Unit"
|
||||||
|
find . -name CVS -exec rm -rf {} \; 2> /dev/null
|
||||||
|
|
||||||
|
# tar it up
|
||||||
|
rm /tmp/knowledgeTree-$version.tgz 2> /dev/null
|
||||||
|
tar -czvf /tmp/knowledgeTree-$version.tgz knowledgeTree
|
||||||
|
|
||||||
|
# convert src to windoze line-endings
|
||||||
|
find $tmp/knowledgeTree -name \*\.php -exec unix2dos {} \; 2> /dev/null
|
||||||
|
find $tmp/knowledgeTree -name \*\.inc -exec unix2dos {} \; 2> /dev/null
|
||||||
|
find $tmp/knowledgeTree -name \*\.txt -exec unix2dos {} \; 2> /dev/null
|
||||||
|
|
||||||
|
# zip it up
|
||||||
|
rm /tmp/knowledgeTree-$version.zip 2> /dev/null
|
||||||
|
zip -r /tmp/knowledgeTree-$version.zip knowledgeTree
|
||||||
|
|
||||||
|
# move them to this dir
|
||||||
|
cd -
|
||||||
|
mv /tmp/knowledgeTree-$version.* .
|
||||||
|
|
||||||
|
# clean up
|
||||||
|
rm -rf $tmp 2> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# check the command line options
|
||||||
|
if [ $# -lt 2 ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
# process the params
|
||||||
|
while getopts ":b:v:" Option
|
||||||
|
do
|
||||||
|
case $Option in
|
||||||
|
b ) branch=$OPTARG;;
|
||||||
|
v ) version=$OPTARG;;
|
||||||
|
* ) usage;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# check that everything we want is set
|
||||||
|
if [ -z $branch -o -z $version ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
# setup up some paths and stuff
|
||||||
|
cvsroot=/usr/local/cvsroot
|
||||||
|
tmp=/tmp/dms
|
||||||
|
|
||||||
|
# now just do it
|
||||||
|
deploy
|
||||||
284
bin/scheduler.php
Normal file
284
bin/scheduler.php
Normal file
@ -0,0 +1,284 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): ______________________________________
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
chdir(dirname(__FILE__));
|
||||||
|
require_once('../config/dmsDefaults.php');
|
||||||
|
require_once(KT_LIB_DIR . '/database/dbutil.inc');
|
||||||
|
|
||||||
|
// Set the time limit to 0 to prevent the script timing out
|
||||||
|
set_time_limit(0);
|
||||||
|
|
||||||
|
global $default;
|
||||||
|
|
||||||
|
// Check the lock file before starting
|
||||||
|
$lock = $default->cacheDirectory . DIRECTORY_SEPARATOR . 'scheduler.lock';
|
||||||
|
if(file_exists($lock)){
|
||||||
|
$default->log->debug('Scheduler: can\'t start - lock file exists');
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE commented out because it was causing problems with the new locations in KnowledgeTree 3.7
|
||||||
|
/*
|
||||||
|
// If this is *nix and we are root then make sure file permisions are correct
|
||||||
|
if(!OS_WINDOWS && (get_current_user() == 'root'))
|
||||||
|
{
|
||||||
|
// The log files...
|
||||||
|
try {
|
||||||
|
$default->log->debug( 'Scheduler: setting owner to nobody on - '.$default->logDirectory);
|
||||||
|
exec('chown -R nobody:0 '.escapeshellcmd($default->logDirectory));
|
||||||
|
} catch(Exception $e) {
|
||||||
|
$default->log->error('Scheduler: can\'t set owner to nobody - '.$e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ** Set up functions ** */
|
||||||
|
|
||||||
|
// Calculate the next run time based on the frequency of iteration and the given time
|
||||||
|
function calculateRunTime($sFreq, $iTime) {
|
||||||
|
|
||||||
|
switch($sFreq){
|
||||||
|
case 'monthly':
|
||||||
|
$iDays = date('t');
|
||||||
|
$iDiff = (60*60)*24*$iDays;
|
||||||
|
break;
|
||||||
|
case 'weekly':
|
||||||
|
$iDiff = (60*60)*24*7;
|
||||||
|
break;
|
||||||
|
case 'daily':
|
||||||
|
$iDiff = (60*60)*24;
|
||||||
|
break;
|
||||||
|
case 'hourly':
|
||||||
|
$iDiff = (60*60);
|
||||||
|
break;
|
||||||
|
case 'half_hourly':
|
||||||
|
$iDiff = (60*30);
|
||||||
|
break;
|
||||||
|
case 'quarter_hourly':
|
||||||
|
$iDiff = (60*15);
|
||||||
|
break;
|
||||||
|
case '10mins':
|
||||||
|
$iDiff = (60*10);
|
||||||
|
break;
|
||||||
|
case '5mins':
|
||||||
|
$iDiff = (60*5);
|
||||||
|
break;
|
||||||
|
case '1min':
|
||||||
|
$iDiff = 60;
|
||||||
|
break;
|
||||||
|
case '30secs':
|
||||||
|
$iDiff = 30;
|
||||||
|
break;
|
||||||
|
case 'once':
|
||||||
|
$iDiff = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$iNextTime = $iTime + $iDiff;
|
||||||
|
return $iNextTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update the task information in the database
|
||||||
|
function updateTask($aFieldValues, $iId) {
|
||||||
|
DBUtil::autoUpdate('scheduler_tasks', $aFieldValues, $iId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the list of tasks due to be run from the database
|
||||||
|
function getTaskList() {
|
||||||
|
$now = date('Y-m-d H:i:s'); //time();
|
||||||
|
|
||||||
|
$query = "SELECT * FROM scheduler_tasks WHERE is_complete = 0 AND run_time < '{$now}' AND status != 'disabled'";
|
||||||
|
|
||||||
|
$result = DBUtil::getResultArray($query);
|
||||||
|
|
||||||
|
if (PEAR::isError($result)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ** Scheduler script ** */
|
||||||
|
|
||||||
|
$default->log->debug('Scheduler: starting');
|
||||||
|
|
||||||
|
// Get task list
|
||||||
|
$aList = getTaskList();
|
||||||
|
if (empty($aList))
|
||||||
|
{
|
||||||
|
$default->log->debug('Scheduler: stopping - nothing to do');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loop through tasks and run
|
||||||
|
|
||||||
|
foreach($aList as $item)
|
||||||
|
{
|
||||||
|
$aUpdate = array();
|
||||||
|
$iEnd = 0; $iStart = 0; $iDuration = 0;
|
||||||
|
$sFreq = ''; $sParameters = '';
|
||||||
|
$retval = TRUE;
|
||||||
|
|
||||||
|
// Set up start variables
|
||||||
|
$sTask = $item['task'];
|
||||||
|
$sTaskUrl = $item['script_url'];
|
||||||
|
$iDuration = $item['run_duration'];
|
||||||
|
$sFreq = $item['frequency'];
|
||||||
|
$sParameters = $item['script_params'];
|
||||||
|
|
||||||
|
// Check if script is windows or *nix compatible
|
||||||
|
$ext = pathinfo($sTaskUrl, PATHINFO_EXTENSION);
|
||||||
|
$script = substr($sTaskUrl,0,-strlen($ext)-1);
|
||||||
|
|
||||||
|
if(OS_WINDOWS)
|
||||||
|
{
|
||||||
|
$mapping = array('sh'=>'bin','bat'=>'exe');
|
||||||
|
if (array_key_exists($ext, $mapping))
|
||||||
|
{
|
||||||
|
$sTaskUrl = $script . '.' . $mapping[$ext];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mapping = array('bat'=>'sh', 'exe'=>'bin');
|
||||||
|
|
||||||
|
if (array_key_exists($ext, $mapping))
|
||||||
|
{
|
||||||
|
switch ($ext)
|
||||||
|
{
|
||||||
|
case 'exe':
|
||||||
|
if (is_executable(KT_DIR . '/' . $script))
|
||||||
|
{
|
||||||
|
$sTaskUrl = $script;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
$sTaskUrl = $script . '.' . $mapping[$ext];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_executable(KT_DIR . '/' . $script) && $ext != 'php')
|
||||||
|
{
|
||||||
|
$default->log->error("Scheduler: The script '{$sTaskUrl}' is not executable.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = realpath(KT_DIR . '/' . $sTaskUrl);
|
||||||
|
|
||||||
|
if ($file === false)
|
||||||
|
{
|
||||||
|
$default->log->error("Scheduler: The script '{$sTaskUrl}' cannot be resolved.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$iTime = time();
|
||||||
|
$iStart = KTUtil::getBenchmarkTime();
|
||||||
|
|
||||||
|
// Run the script
|
||||||
|
|
||||||
|
$cmd = "\"$file\" {$sParameters}";
|
||||||
|
|
||||||
|
if ($ext == 'php')
|
||||||
|
{
|
||||||
|
$oKTConfig = KTConfig::getSingleton();
|
||||||
|
$phpPath = $oKTConfig->get('externalBinary/php', 'php');
|
||||||
|
//$phpPath = KTUtil::findCommand('externalBinary/php');
|
||||||
|
|
||||||
|
// being protective as some scripts work on relative paths
|
||||||
|
$dirname = dirname($file);
|
||||||
|
chdir($dirname);
|
||||||
|
|
||||||
|
$cmd = "\"$phpPath\" $cmd";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (OS_WINDOWS)
|
||||||
|
{ $default->log->debug("Scheduler - dirname: $dirname cmd: $cmd");
|
||||||
|
//$WshShell = new COM("WScript.Shell");
|
||||||
|
//$res = $WshShell->Run($cmd, 0, true);
|
||||||
|
|
||||||
|
KTUtil::pexec($cmd);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$cmd .= (strtolower($sTask) == 'openoffice test') ? ' >/dev/null &' : ' 2>&1';
|
||||||
|
|
||||||
|
$default->log->debug("Scheduler cmd: $cmd");
|
||||||
|
$res = shell_exec($cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
// On completion - reset run time
|
||||||
|
$iEnd = KTUtil::getBenchmarkTime();
|
||||||
|
$iDuration = number_format($iEnd - $iStart,2);
|
||||||
|
|
||||||
|
|
||||||
|
$ignore = array('openoffice test');
|
||||||
|
|
||||||
|
if (!empty($res))
|
||||||
|
{
|
||||||
|
$func = in_array(strtolower($sTask), $ignore)?'debug':'info';
|
||||||
|
|
||||||
|
$default->log->$func("Scheduler - Task: $sTask");
|
||||||
|
$default->log->$func("Scheduler - Command: $cmd");
|
||||||
|
$default->log->$func("Scheduler - Output: $res");
|
||||||
|
$default->log->$func("Scheduler - Background tasks should not produce output. Please review why this is producing output.");
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$default->log->debug("Scheduler - Task: {$sTask} completed in {$iDuration}s.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(($sFreq == 'once' || empty($sFreq)) && $retval !== FALSE)
|
||||||
|
{
|
||||||
|
// Set is_complete to true
|
||||||
|
$aUpdate['is_complete'] = '1';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$iNextTime = calculateRunTime($sFreq, $iTime);
|
||||||
|
$aUpdate['run_time'] = date('Y-m-d H:i:s', $iNextTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
$aUpdate['previous_run_time'] = date('Y-m-d H:i:s', $iTime);
|
||||||
|
$aUpdate['run_duration'] = $iDuration;
|
||||||
|
|
||||||
|
updateTask($aUpdate, $item['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$default->log->debug('Scheduler: stopping');
|
||||||
|
exit(0);
|
||||||
|
?>
|
||||||
132
bin/smarty_to_gettext.php
Normal file
132
bin/smarty_to_gettext.php
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tsmarty2c.php - rips gettext strings from smarty template
|
||||||
|
*
|
||||||
|
* ------------------------------------------------------------------------- *
|
||||||
|
* This library is free software; you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU Lesser General Public *
|
||||||
|
* License as published by the Free Software Foundation; either *
|
||||||
|
* version 2.1 of the License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This library 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 *
|
||||||
|
* Lesser General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU Lesser General Public *
|
||||||
|
* License along with this library; if not, write to the Free Software *
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
||||||
|
* ------------------------------------------------------------------------- *
|
||||||
|
*
|
||||||
|
* This command line script rips gettext strings from smarty file,
|
||||||
|
* and prints them to stdout in C format, that can later be used with the
|
||||||
|
* standard gettext tools.
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
* ./tsmarty2c.php <filename or directory> <file2> <..> > smarty.c
|
||||||
|
*
|
||||||
|
* If a parameter is a directory, the template files within will be parsed.
|
||||||
|
*
|
||||||
|
* @version $Id$
|
||||||
|
* @link http://smarty-gettext.sf.net/
|
||||||
|
* @author Sagi Bashari <sagi@boom.org.il>
|
||||||
|
* @copyright 2004-2005 Sagi Bashari
|
||||||
|
*/
|
||||||
|
|
||||||
|
// smarty open tag
|
||||||
|
$ldq = preg_quote('{');
|
||||||
|
|
||||||
|
// smarty close tag
|
||||||
|
$rdq = preg_quote('}');
|
||||||
|
|
||||||
|
// smarty command
|
||||||
|
$cmd = preg_quote('i18n');
|
||||||
|
|
||||||
|
// extensions of smarty files, used when going through a directory
|
||||||
|
$extensions = array('smarty');
|
||||||
|
|
||||||
|
// "fix" string - strip slashes, escape and convert new lines to \n
|
||||||
|
function fs($str)
|
||||||
|
{
|
||||||
|
$str = stripslashes($str);
|
||||||
|
$str = trim($str);
|
||||||
|
$str = str_replace('"', '\"', $str);
|
||||||
|
$str = str_replace("\n", '\n', $str);
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
|
||||||
|
// rips gettext strings from $file and prints them in C format
|
||||||
|
function do_file($file)
|
||||||
|
{
|
||||||
|
$content = @file_get_contents($file);
|
||||||
|
|
||||||
|
if (empty($content)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
global $ldq, $rdq, $cmd;
|
||||||
|
|
||||||
|
preg_match_all(
|
||||||
|
"/{$ldq}\s*({$cmd})\s*([^{$rdq}]*){$rdq}([^{$ldq}]*){$ldq}\/\\1{$rdq}/",
|
||||||
|
$content,
|
||||||
|
$matches
|
||||||
|
);
|
||||||
|
|
||||||
|
for ($i=0; $i < count($matches[0]); $i++) {
|
||||||
|
// TODO: add line number
|
||||||
|
echo "/* $file */\n"; // credit: Mike van Lammeren 2005-02-14
|
||||||
|
|
||||||
|
$content = $matches[3][$i];
|
||||||
|
if (!preg_match('/formatmatters\s*=\s*["\']?\s*(.[^\"\']*)\s*["\']?/', $matches[2][$i], $match)) {
|
||||||
|
$replace = array(
|
||||||
|
'@ *[\n\r]+@' => ' ',
|
||||||
|
);
|
||||||
|
$content = preg_replace(array_keys($replace), array_values($replace), $content);
|
||||||
|
}
|
||||||
|
if (preg_match('/plural\s*=\s*["\']?\s*(.[^\"\']*)\s*["\']?/', $matches[2][$i], $match)) {
|
||||||
|
echo 'ngettext("'.fs($content).'","'.fs($match[1]).'",x);'."\n";
|
||||||
|
} else {
|
||||||
|
echo 'gettext("'.fs($content).'");'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// go through a directory
|
||||||
|
function do_dir($dir)
|
||||||
|
{
|
||||||
|
$d = dir($dir);
|
||||||
|
|
||||||
|
while (false !== ($entry = $d->read())) {
|
||||||
|
if ($entry == '.' || $entry == '..') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$entry = $dir.'/'.$entry;
|
||||||
|
|
||||||
|
if (is_dir($entry)) { // if a directory, go through it
|
||||||
|
do_dir($entry);
|
||||||
|
} else { // if file, parse only if extension is matched
|
||||||
|
$pi = pathinfo($entry);
|
||||||
|
|
||||||
|
if (isset($pi['extension']) && in_array($pi['extension'], $GLOBALS['extensions'])) {
|
||||||
|
do_file($entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$d->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
for ($ac=1; $ac < $_SERVER['argc']; $ac++) {
|
||||||
|
if (is_dir($_SERVER['argv'][$ac])) { // go through directory
|
||||||
|
do_dir($_SERVER['argv'][$ac]);
|
||||||
|
} else { // do file
|
||||||
|
do_file($_SERVER['argv'][$ac]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
190
bin/storageverification.php
Normal file
190
bin/storageverification.php
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): ______________________________________
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once(dirname(__FILE__) . '/../config/dmsDefaults.php');
|
||||||
|
require_once(KT_LIB_DIR . '/storage/storagemanager.inc.php');
|
||||||
|
|
||||||
|
// TODO: this does not verify files that are in the storage system, but not on the database. It is better that the storage system
|
||||||
|
// be in sync with the database. However, we should have a better way to query the storage driver to give us a list of files.
|
||||||
|
|
||||||
|
class StorageVerification
|
||||||
|
{
|
||||||
|
private $count;
|
||||||
|
private $lineCount;
|
||||||
|
private $doc;
|
||||||
|
const DOCS_PER_DOT = 100;
|
||||||
|
const DOTS_PER_LINE = 80;
|
||||||
|
private $nl;
|
||||||
|
private $tab;
|
||||||
|
|
||||||
|
private
|
||||||
|
function error($msg)
|
||||||
|
{
|
||||||
|
$doc = $this->doc;
|
||||||
|
$documentId = $doc->getId();
|
||||||
|
$path = $doc->getFullPath();
|
||||||
|
$filename = $doc->getFileName();
|
||||||
|
$storagePath = $doc->getStoragePath();
|
||||||
|
|
||||||
|
print "{$this->nl}{$this->nl}";
|
||||||
|
print "Problem with Document ID: {$documentId}{$this->nl}";
|
||||||
|
print "{$this->tab}Path: {$path}{$this->nl}";
|
||||||
|
print "{$this->tab}Filename: {$filename}{$this->nl}";
|
||||||
|
print "{$this->tab}StoragePath: {$storagePath}{$this->nl}";
|
||||||
|
print "{$this->tab}Problem: {$msg}{$this->nl}{$this->nl}";
|
||||||
|
flush();
|
||||||
|
$this->count = 0;
|
||||||
|
$this->lineCount = 0;
|
||||||
|
$this->clearCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
private
|
||||||
|
function progress()
|
||||||
|
{
|
||||||
|
if ($this->count++ % StorageVerification::DOCS_PER_DOT == 0)
|
||||||
|
{
|
||||||
|
$this->lineCount++;
|
||||||
|
print '.';
|
||||||
|
flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->lineCount == StorageVerification::DOTS_PER_LINE )
|
||||||
|
{
|
||||||
|
print "{$this->nl}";
|
||||||
|
flush();
|
||||||
|
$this->lineCount = 0;
|
||||||
|
}
|
||||||
|
$this->clearCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
private
|
||||||
|
function clearCache()
|
||||||
|
{
|
||||||
|
$metadataid = $this->doc->getMetadataVersionId();
|
||||||
|
$contentid = $this->doc->getContentVersionId();
|
||||||
|
$iId = $this->doc->getId();
|
||||||
|
$cache = KTCache::getSingleton();
|
||||||
|
$cache->remove('KTDocumentMetadataVersion/id', $metadataid);
|
||||||
|
$cache->remove('KTDocumentContentVersion/id', $contentid);
|
||||||
|
$cache->remove('KTDocumentCore/id', $iId);
|
||||||
|
$cache->remove('Document/id', $iId);
|
||||||
|
unset($GLOBALS['_OBJECTCACHE']['KTDocumentMetadataVersion'][$metadataid]);
|
||||||
|
unset($GLOBALS['_OBJECTCACHE']['KTDocumentContentVersion'][$contentid]);
|
||||||
|
unset($GLOBALS['_OBJECTCACHE']['KTDocumentCore'][$iId]);
|
||||||
|
|
||||||
|
unset($this->doc);
|
||||||
|
}
|
||||||
|
|
||||||
|
public
|
||||||
|
function run()
|
||||||
|
{
|
||||||
|
global $argc;
|
||||||
|
|
||||||
|
if (isset($argc))
|
||||||
|
{
|
||||||
|
$this->nl = "\n";
|
||||||
|
$this->tab = "\t";
|
||||||
|
print "Storage Verification{$this->nl}";
|
||||||
|
print "===================={$this->nl}";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->nl = '<br>';
|
||||||
|
$this->tab = ' ';
|
||||||
|
print "<b>Storage Verification</b>{$this->nl}";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$sql = "SELECT
|
||||||
|
dmv.id as metadata_version_id, dcv.document_id, dcv.md5hash, dcv.size
|
||||||
|
FROM
|
||||||
|
document_content_version dcv
|
||||||
|
INNER JOIN document_metadata_version dmv ON dcv.id=dmv.content_version_id";
|
||||||
|
$rows = DBUtil::getResultArray($sql);
|
||||||
|
$this->count = 0;
|
||||||
|
$this->lineCount = 0;
|
||||||
|
|
||||||
|
$storage =& KTStorageManagerUtil::getSingleton();
|
||||||
|
foreach($rows as $row)
|
||||||
|
{
|
||||||
|
$doc = Document::get($row['document_id'], $row['metadata_version_id']);
|
||||||
|
|
||||||
|
if (PEAR::isError($doc))
|
||||||
|
{
|
||||||
|
$msg = $doc->getMessage();
|
||||||
|
$this->error($doc, "Error with document: {$msg}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$this->doc = $doc;
|
||||||
|
|
||||||
|
$tmpPath = $storage->temporaryFile($doc);
|
||||||
|
if (!file_exists($tmpPath))
|
||||||
|
{
|
||||||
|
$this->error("Temporary file could not be resolved: {$tmpPath}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$expectedSize = $row['size'];
|
||||||
|
$currentSize = filesize($tmpPath);
|
||||||
|
if ($expectedSize != $currentSize)
|
||||||
|
{
|
||||||
|
$this->error("Filesize does not match. Expected: {$expectedSize} Current: {$currentSize}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$expectedHash = $row['md5hash'];
|
||||||
|
$currentHash = md5_file($tmpPath);
|
||||||
|
if ($expectedHash != $currentHash)
|
||||||
|
{
|
||||||
|
$this->error("Hash does not match. Expected: {$expectedHash} Current: {$currentHash}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$this->progress();
|
||||||
|
}
|
||||||
|
|
||||||
|
print "{$this->nl}Done.{$this->nl}{$this->nl}";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$verification = new StorageVerification();
|
||||||
|
$verification->run();
|
||||||
|
|
||||||
|
?>
|
||||||
198
bin/system_info.php
Normal file
198
bin/system_info.php
Normal file
@ -0,0 +1,198 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* $Id:
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): ______________________________________
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Script to collect system information as part of a call home mechanism, no identifying information is stored.
|
||||||
|
*
|
||||||
|
* The following data is collected:
|
||||||
|
* Unique installation information: installation GUID, number of users in repository, number of documents in repository,
|
||||||
|
* operating system (platform, platform version, flavor if Linux), version and edition.
|
||||||
|
|
||||||
|
<installation guid>|<enabled user count>|<disabled user count>|<deleted user count>|
|
||||||
|
<live document count>|<deleted document count>|<archived document count>|
|
||||||
|
<KT version>|<KT edition>|<User licenses>|<OS info>
|
||||||
|
*/
|
||||||
|
|
||||||
|
chdir(realpath(dirname(__FILE__)));
|
||||||
|
require_once('../config/dmsDefaults.php');
|
||||||
|
|
||||||
|
global $default;
|
||||||
|
$default->log->debug('System information collection script starting...');
|
||||||
|
|
||||||
|
// Get installation guid
|
||||||
|
function getGuid()
|
||||||
|
{
|
||||||
|
$guid = KTUtil::getSystemIdentifier();
|
||||||
|
|
||||||
|
if(PEAR::isError($guid)){
|
||||||
|
$guid = '-';
|
||||||
|
}
|
||||||
|
return $guid;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the number of users in the repository
|
||||||
|
function getUserCnt()
|
||||||
|
{
|
||||||
|
$query = 'select count(*) as cnt, disabled from users where id > 0 group by disabled;';
|
||||||
|
$result = DBUtil::getResultArray($query);
|
||||||
|
|
||||||
|
if(empty($result) || PEAR::isError($result)){
|
||||||
|
return '-|-|-';
|
||||||
|
}
|
||||||
|
$enabled = '-';
|
||||||
|
$disabled = '-';
|
||||||
|
$deleted = '-';
|
||||||
|
|
||||||
|
foreach ($result as $row){
|
||||||
|
switch($row['disabled']){
|
||||||
|
case 0: $enabled = $row['cnt']; break;
|
||||||
|
case 1: $disabled = $row['cnt']; break;
|
||||||
|
case 2: $deleted = $row['cnt']; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "{$enabled}|{$disabled}|{$deleted}";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the number of documents in the repository
|
||||||
|
function getDocCnt()
|
||||||
|
{
|
||||||
|
$query = 'select count(*) as cnt, status_id from documents d WHERE status_id IN (1,3,4) group by d.status_id;';
|
||||||
|
$result2 = DBUtil::getResultArray($query);
|
||||||
|
|
||||||
|
if(empty($result2) || PEAR::isError($result2)){
|
||||||
|
return '-|-|-';
|
||||||
|
}
|
||||||
|
$live = '-';
|
||||||
|
$deleted = '-';
|
||||||
|
$archived = '-';
|
||||||
|
|
||||||
|
foreach ($result2 as $row){
|
||||||
|
switch($row['status_id']){
|
||||||
|
case 1: $live = $row['cnt']; break;
|
||||||
|
case 3: $deleted = $row['cnt']; break;
|
||||||
|
case 4: $archived = $row['cnt']; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "{$live}|{$deleted}|{$archived}";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the version of KT
|
||||||
|
function getKTVersion()
|
||||||
|
{
|
||||||
|
$version = KTUtil::getSystemSetting('knowledgeTreeVersion');
|
||||||
|
if(empty($version) || PEAR::isError($version)){
|
||||||
|
$version = file_get_contents(KT_DIR . 'docs/VERSION.txt');
|
||||||
|
}
|
||||||
|
// remove newline that is in the version file
|
||||||
|
$version = str_replace("\n", '', $version);
|
||||||
|
return $version;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the edition of KT
|
||||||
|
function getKTEdition()
|
||||||
|
{
|
||||||
|
$edition = 'Community|-';
|
||||||
|
if (KTPluginUtil::pluginIsActive('ktdms.wintools')) {
|
||||||
|
$path = KTPluginUtil::getPluginPath('ktdms.wintools');
|
||||||
|
require_once($path . 'baobabkeyutil.inc.php');
|
||||||
|
$edition = BaobabKeyUtil::getName();
|
||||||
|
|
||||||
|
// this could be done with regular expressions...
|
||||||
|
// Remove the brackets around the name
|
||||||
|
$edition = substr($edition, 1);
|
||||||
|
$edition = substr($edition, 0, strlen($edition)-1);
|
||||||
|
// Remove the "users"
|
||||||
|
$pos = strpos($edition, 'users');
|
||||||
|
$edition = ($pos === false) ? $edition.'|-' : substr($edition, 0, $pos-1);
|
||||||
|
// Replace the , with |
|
||||||
|
$edition = str_replace(', ', '|', $edition);
|
||||||
|
}
|
||||||
|
return $edition;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Get OS info - platform, version, linux flavour
|
||||||
|
function getOSInfo()
|
||||||
|
{
|
||||||
|
$server = php_uname();
|
||||||
|
$server_arr = explode(' ', $server);
|
||||||
|
|
||||||
|
// kernel version and os type - 32bit / 64bit
|
||||||
|
$kernel_v = $server_arr[2];
|
||||||
|
$os_v = array_pop($server_arr);
|
||||||
|
|
||||||
|
if(strpos($server, 'Darwin') !== false){
|
||||||
|
$os = 'Mac OS X';
|
||||||
|
}else if(strpos($server, 'Win') !== false){
|
||||||
|
$os = 'Windows';
|
||||||
|
// windows differs from *nix
|
||||||
|
// kernel version = windows version
|
||||||
|
// os version = build number
|
||||||
|
$kernel_v = $server_arr[3];
|
||||||
|
}else if(strpos($server, 'Linux') !== false) {
|
||||||
|
$os = 'Linux';
|
||||||
|
}else {
|
||||||
|
$os = 'Unix';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $os.'|'.$kernel_v.'|'.$os_v;
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendForm($data)
|
||||||
|
{
|
||||||
|
$url = 'http://ktnetwork.knowledgetree.com/call_home.php';
|
||||||
|
$data = http_build_query($data);
|
||||||
|
|
||||||
|
$ch = curl_init($url);
|
||||||
|
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST, false);
|
||||||
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
||||||
|
curl_exec($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
}
|
||||||
|
|
||||||
|
$post_str = getGuid() .'|'. getUserCnt() .'|'. getDocCnt() .'|'. getKTVersion() .'|'. getKTEdition() .'|'. getOSInfo();
|
||||||
|
$data['system_info'] = $post_str;
|
||||||
|
|
||||||
|
sendForm($data);
|
||||||
|
|
||||||
|
$default->log->debug('System information collection script finishing.');
|
||||||
|
exit(0);
|
||||||
|
?>
|
||||||
27
bin/upgrade/pear-upgrade.bat
Normal file
27
bin/upgrade/pear-upgrade.bat
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
; TEST ALL PEAR LIBRARIES BEFORE UPGRADING INTO RELEASE
|
||||||
|
|
||||||
|
PATH=%PATH%;c:\php5\PEAR
|
||||||
|
|
||||||
|
pear channel-update pear.php.net
|
||||||
|
pear config-set php_dir "C:\kt\kt.trunk\thirdparty\pear"
|
||||||
|
|
||||||
|
pear config-set preferred_state stable
|
||||||
|
|
||||||
|
pear upgrade --alldeps PEAR
|
||||||
|
pear upgrade --alldeps Cache_Lite
|
||||||
|
pear upgrade --alldeps Config
|
||||||
|
pear upgrade --alldeps DB
|
||||||
|
pear upgrade --alldeps File
|
||||||
|
|
||||||
|
;pear upgrade --alldeps MDB2#mysql
|
||||||
|
|
||||||
|
pear upgrade --alldeps Log
|
||||||
|
pear upgrade --alldeps PHP_Compat
|
||||||
|
|
||||||
|
pear config-set preferred_state beta
|
||||||
|
pear upgrade --alldeps File_Gettext
|
||||||
|
pear upgrade --alldeps Net_LDAP
|
||||||
|
pear upgrade --alldeps SOAP
|
||||||
|
pear config-set preferred_state stable
|
||||||
|
|
||||||
61
bin/upgrade/pre-upgrade-3.0b3.php
Normal file
61
bin/upgrade/pre-upgrade-3.0b3.php
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): ______________________________________
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
$checkup = true;
|
||||||
|
|
||||||
|
require_once('../../config/dmsDefaults.php');
|
||||||
|
|
||||||
|
$s = array(
|
||||||
|
"sql*2.99.5*0*2.99.5/dashlet_disabling.sql",
|
||||||
|
"sql*2.99.5*0*2.99.5/role_allocations.sql",
|
||||||
|
"sql*2.99.5*0*2.99.5/transaction_namespaces.sql",
|
||||||
|
"sql*2.99.5*0*2.99.5/fieldset_field_descriptions.sql",
|
||||||
|
"sql*2.99.5*0*2.99.5/role_changes.sql",
|
||||||
|
);
|
||||||
|
|
||||||
|
$sTable = KTUtil::getTableName('upgrades');
|
||||||
|
|
||||||
|
foreach ($s as $u) {
|
||||||
|
var_dump($u);
|
||||||
|
$f = array(
|
||||||
|
'descriptor' => $u,
|
||||||
|
'result' => true,
|
||||||
|
);
|
||||||
|
$res = DBUtil::autoInsert($sTable, $f);
|
||||||
|
var_dump($res);
|
||||||
|
}
|
||||||
49
bin/upgrade/upgrade-to-2.0.6.php
Normal file
49
bin/upgrade/upgrade-to-2.0.6.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): ______________________________________
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once('../../config/dmsDefaults.php');
|
||||||
|
require_once(KT_DIR . '/lib/upgrades/UpgradeFunctions.inc.php');
|
||||||
|
|
||||||
|
$oUF = new UpgradeFunctions();
|
||||||
|
$aFuncs = $oUF->upgrades['2.0.6'];
|
||||||
|
foreach ($aFuncs as $sFunc) {
|
||||||
|
$f = array('UpgradeFunctions', $sFunc);
|
||||||
|
call_user_func($f);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
50
bin/win32/installScheduler.php
Normal file
50
bin/win32/installScheduler.php
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): ______________________________________
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
$scriptPath = realpath(dirname(__FILE__) . '/taskrunner.bat');
|
||||||
|
|
||||||
|
win32_create_service(array(
|
||||||
|
'service' => 'ktscheduler',
|
||||||
|
'display' => 'ktdmsScheduler',
|
||||||
|
'path' => $scriptPath
|
||||||
|
));
|
||||||
|
|
||||||
|
//win32_start_service('ktscheduler');
|
||||||
|
|
||||||
|
?>
|
||||||
150
bin/win32/schedulerService.php
Normal file
150
bin/win32/schedulerService.php
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): ______________________________________
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
$myservicename = 'ktscheduler';
|
||||||
|
|
||||||
|
// Connect to service dispatcher and notify that startup was successful
|
||||||
|
if (!win32_start_service_ctrl_dispatcher($myservicename)) die('Could not connect to service :'.$myservicename);
|
||||||
|
win32_set_service_status(WIN32_SERVICE_RUNNING);
|
||||||
|
|
||||||
|
// Scheduler is dependent on the mysql server being up,
|
||||||
|
// so we sleep for a minute to ensure the server is running before we start the scheduler
|
||||||
|
sleep(120);
|
||||||
|
|
||||||
|
chdir(dirname(__FILE__)); // need to be here to include dmsDefaults
|
||||||
|
require_once('../../config/dmsDefaults.php');
|
||||||
|
|
||||||
|
global $default;
|
||||||
|
|
||||||
|
$config = KTConfig::getSingleton();
|
||||||
|
$schedulerInterval = $config->get('KnowledgeTree/schedulerInterval',30); // interval in seconds
|
||||||
|
|
||||||
|
// Change to knowledgeTree/bin folder
|
||||||
|
$dir = realpath(dirname(__FILE__) . '/..');
|
||||||
|
chdir($dir);
|
||||||
|
|
||||||
|
// Setup php binary path
|
||||||
|
$phpPath = $config->get('externalBinary/php','php');
|
||||||
|
if (!is_file($phpPath))
|
||||||
|
{
|
||||||
|
$default->log->error("Scheduler: php not found: $phpPath");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$loop = true;
|
||||||
|
$bTableExists = false;
|
||||||
|
|
||||||
|
while(!$bTableExists){
|
||||||
|
switch (win32_get_last_control_message())
|
||||||
|
{
|
||||||
|
|
||||||
|
case WIN32_SERVICE_CONTROL_CONTINUE:
|
||||||
|
break; // Continue server routine
|
||||||
|
case WIN32_SERVICE_CONTROL_INTERROGATE:
|
||||||
|
win32_set_service_status(WIN32_SERVICE_RUNNING);
|
||||||
|
break; // Respond with status
|
||||||
|
case WIN32_SERVICE_CONTROL_STOP:
|
||||||
|
win32_set_service_status(WIN32_SERVICE_STOPPED);
|
||||||
|
$loop = false; // Terminate script
|
||||||
|
$bTableExists = true;
|
||||||
|
continue;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
|
||||||
|
$default->log->info("Scheduler Service: Checking if the scheduler_tasks table exists.");
|
||||||
|
|
||||||
|
$checkQuery = 'show tables';
|
||||||
|
$tableList = DBUtil::getResultArray($checkQuery);
|
||||||
|
|
||||||
|
if(!empty($tableList)){
|
||||||
|
foreach($tableList as $table){
|
||||||
|
if(in_array('scheduler_tasks', $table)){
|
||||||
|
$bTableExists = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!$bTableExists){
|
||||||
|
$default->log->error('Scheduler Service: Scheduler_tasks table does not exist, sleeping for 30 seconds');
|
||||||
|
sleep(30);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$default->log->info("Scheduler Service: starting main loop");
|
||||||
|
|
||||||
|
// Main Scheduler Service Loop
|
||||||
|
while ($loop)
|
||||||
|
{
|
||||||
|
switch (win32_get_last_control_message())
|
||||||
|
{
|
||||||
|
|
||||||
|
case WIN32_SERVICE_CONTROL_CONTINUE:
|
||||||
|
break; // Continue server routine
|
||||||
|
case WIN32_SERVICE_CONTROL_INTERROGATE:
|
||||||
|
win32_set_service_status(WIN32_SERVICE_RUNNING);
|
||||||
|
break; // Respond with status
|
||||||
|
case WIN32_SERVICE_CONTROL_STOP:
|
||||||
|
win32_set_service_status(WIN32_SERVICE_STOPPED);
|
||||||
|
$loop = false; // Terminate script
|
||||||
|
continue;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
// Run the scheduler script
|
||||||
|
$cmd = "\"$phpPath\" \"$dir/scheduler.php\"";
|
||||||
|
$default->log->info('Scheduler Service: cmd - ' .$cmd );
|
||||||
|
|
||||||
|
$WshShell = new COM("WScript.Shell");
|
||||||
|
$res = $WshShell->Run($cmd, 0, true);
|
||||||
|
//$cmd = str_replace( '/','\\',$cmd);
|
||||||
|
//$res = `$cmd 2>&1`;
|
||||||
|
if (!empty($res))
|
||||||
|
{
|
||||||
|
$default->log->error('Scheduler Service: unexpected output - ' .$res);
|
||||||
|
}
|
||||||
|
|
||||||
|
sleep($schedulerInterval);
|
||||||
|
|
||||||
|
}
|
||||||
|
win32_set_service_status(WIN32_SERVICE_STOPPED);
|
||||||
|
|
||||||
|
$default->log->error("Scheduler Service: exiting main loop");
|
||||||
|
|
||||||
|
?>
|
||||||
42
bin/win32/schedulerServiceStatus.php
Normal file
42
bin/win32/schedulerServiceStatus.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): ______________________________________
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
var_dump(win32_query_service_status('ktscheduler'));
|
||||||
|
|
||||||
|
?>
|
||||||
3
bin/win32/taskrunner.bat
Normal file
3
bin/win32/taskrunner.bat
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
@echo off
|
||||||
|
"@@BITROCK_INSTALLDIR@@\php\php.exe" "@@BITROCK_INSTALLDIR@@\knowledgeTree\bin\win32\schedulerService.php"
|
||||||
|
|
||||||
42
bin/win32/uninstallScheduler.php
Normal file
42
bin/win32/uninstallScheduler.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): ______________________________________
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
win32_delete_service('ktscheduler');
|
||||||
|
|
||||||
|
?>
|
||||||
BIN
bin/win32/winserv.exe
Normal file
BIN
bin/win32/winserv.exe
Normal file
Binary file not shown.
441
browse.php
Normal file
441
browse.php
Normal file
@ -0,0 +1,441 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): ______________________________________
|
||||||
|
*/
|
||||||
|
|
||||||
|
// main library routines and defaults
|
||||||
|
require_once('config/dmsDefaults.php');
|
||||||
|
require_once(KT_LIB_DIR . '/templating/templating.inc.php');
|
||||||
|
require_once(KT_LIB_DIR . '/templating/kt3template.inc.php');
|
||||||
|
require_once(KT_LIB_DIR . '/dispatcher.inc.php');
|
||||||
|
require_once(KT_LIB_DIR . '/util/ktutil.inc');
|
||||||
|
require_once(KT_LIB_DIR . '/browse/DocumentCollection.inc.php');
|
||||||
|
require_once(KT_LIB_DIR . '/browse/BrowseColumns.inc.php');
|
||||||
|
require_once(KT_LIB_DIR . '/browse/PartialQuery.inc.php');
|
||||||
|
require_once(KT_LIB_DIR . '/browse/browseutil.inc.php');
|
||||||
|
|
||||||
|
require_once(KT_LIB_DIR . '/foldermanagement/Folder.inc');
|
||||||
|
require_once(KT_LIB_DIR . '/documentmanagement/DocumentType.inc');
|
||||||
|
require_once(KT_LIB_DIR . '/documentmanagement/Document.inc');
|
||||||
|
require_once(KT_LIB_DIR . '/documentmanagement/DocumentField.inc');
|
||||||
|
|
||||||
|
require_once(KT_LIB_DIR . '/widgets/portlet.inc.php');
|
||||||
|
require_once(KT_LIB_DIR . '/actions/folderaction.inc.php');
|
||||||
|
require_once(KT_DIR . '/plugins/ktcore/KTFolderActions.php');
|
||||||
|
|
||||||
|
require_once(KT_LIB_DIR . '/permissions/permissionutil.inc.php');
|
||||||
|
require_once(KT_LIB_DIR . '/permissions/permission.inc.php');
|
||||||
|
|
||||||
|
require_once(KT_LIB_DIR . '/users/userhistory.inc.php');
|
||||||
|
|
||||||
|
require_once(KT_LIB_DIR . '/browse/columnregistry.inc.php');
|
||||||
|
require_once(KT_LIB_DIR . '/actions/entitylist.php');
|
||||||
|
require_once(KT_LIB_DIR . '/actions/bulkaction.php');
|
||||||
|
|
||||||
|
$sectionName = 'browse';
|
||||||
|
|
||||||
|
class BrowseDispatcher extends KTStandardDispatcher {
|
||||||
|
|
||||||
|
var $sName = 'ktcore.actions.folder.view';
|
||||||
|
|
||||||
|
var $oFolder = null;
|
||||||
|
var $sSection = 'browse';
|
||||||
|
var $browse_mode = null;
|
||||||
|
var $query = null;
|
||||||
|
var $resultURL;
|
||||||
|
var $sHelpPage = 'ktcore/browse.html';
|
||||||
|
var $editable;
|
||||||
|
|
||||||
|
function BrowseDispatcher() {
|
||||||
|
$this->aBreadcrumbs = array(
|
||||||
|
array('action' => 'browse', 'name' => _kt('Browse')),
|
||||||
|
);
|
||||||
|
return parent::KTStandardDispatcher();
|
||||||
|
}
|
||||||
|
|
||||||
|
function check() {
|
||||||
|
$this->browse_mode = KTUtil::arrayGet($_REQUEST, 'fBrowseMode', 'folder');
|
||||||
|
$action = KTUtil::arrayGet($_REQUEST, $this->event_var, 'main');
|
||||||
|
$this->editable = false;
|
||||||
|
|
||||||
|
|
||||||
|
// catch the alternative actions.
|
||||||
|
if ($action != 'main') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we're going to main ...
|
||||||
|
|
||||||
|
// folder browse mode
|
||||||
|
if ($this->browse_mode == 'folder') {
|
||||||
|
$in_folder_id = KTUtil::arrayGet($_REQUEST, 'fFolderId');
|
||||||
|
if (empty($in_folder_id)) {
|
||||||
|
$oConfig = KTConfig::getSingleton();
|
||||||
|
if ($oConfig->get('tweaks/browseToUnitFolder')) {
|
||||||
|
$iHomeFolderId = $this->oUser->getHomeFolderId();
|
||||||
|
if ($iHomeFolderId) {
|
||||||
|
$in_folder_id = $iHomeFolderId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$folder_id = (int) $in_folder_id; // conveniently, will be 0 if not possible.
|
||||||
|
if ($folder_id == 0) {
|
||||||
|
$folder_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$_REQUEST['fBrowseMode'] = 'folder';
|
||||||
|
|
||||||
|
// here we need the folder object to do the breadcrumbs.
|
||||||
|
$oFolder =& Folder::get($folder_id);
|
||||||
|
if (PEAR::isError($oFolder)) {
|
||||||
|
return false; // just fail.
|
||||||
|
}
|
||||||
|
|
||||||
|
// check whether the user can edit this folder
|
||||||
|
$oPerm = KTPermission::getByName('ktcore.permissions.write');
|
||||||
|
if (KTPermissionUtil::userHasPermissionOnItem($this->oUser, $oPerm, $oFolder)) {
|
||||||
|
$this->editable = true;
|
||||||
|
} else {
|
||||||
|
$this->editable = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set the title and breadcrumbs...
|
||||||
|
$this->oPage->setTitle(_kt('Browse'));
|
||||||
|
|
||||||
|
if (KTPermissionUtil::userHasPermissionOnItem($this->oUser, 'ktcore.permissions.folder_details', $oFolder)) {
|
||||||
|
$this->oPage->setSecondaryTitle($oFolder->getName());
|
||||||
|
} else {
|
||||||
|
if (KTBrowseUtil::inAdminMode($this->oUser, $oFolder)) {
|
||||||
|
$this->oPage->setSecondaryTitle(sprintf('(%s)', $oFolder->getName()));
|
||||||
|
} else {
|
||||||
|
$this->oPage->setSecondaryTitle('...');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Figure out if we came here by navigating trough a shortcut.
|
||||||
|
//If we came here from a shortcut, the breadcrumbspath should be relative
|
||||||
|
//to the shortcut folder.
|
||||||
|
$iSymLinkFolderId = KTUtil::arrayGet($_REQUEST, 'fShortcutFolder', null);
|
||||||
|
if(is_numeric($iSymLinkFolderId)){
|
||||||
|
$oBreadcrumbsFolder = Folder::get($iSymLinkFolderId);
|
||||||
|
$this->aBreadcrumbs = kt_array_merge($this->aBreadcrumbs, KTBrowseUtil::breadcrumbsForFolder($oBreadcrumbsFolder,array('final' => false)));
|
||||||
|
$this->aBreadcrumbs[] = array('name'=>$oFolder->getName());
|
||||||
|
}else{
|
||||||
|
$this->aBreadcrumbs = kt_array_merge($this->aBreadcrumbs, KTBrowseUtil::breadcrumbsForFolder($oFolder));
|
||||||
|
}
|
||||||
|
$this->oFolder =& $oFolder;
|
||||||
|
|
||||||
|
|
||||||
|
// we now have a folder, and need to create the query.
|
||||||
|
$aOptions = array(
|
||||||
|
'ignorepermissions' => KTBrowseUtil::inAdminMode($this->oUser, $oFolder),
|
||||||
|
);
|
||||||
|
$this->oQuery = new BrowseQuery($oFolder->getId(), $this->oUser, $aOptions);
|
||||||
|
|
||||||
|
$this->resultURL = KTUtil::addQueryString($_SERVER['PHP_SELF'], sprintf('fFolderId=%d', $oFolder->getId()));
|
||||||
|
|
||||||
|
// and the portlets
|
||||||
|
$portlet = new KTActionPortlet(sprintf(_kt('About this folder')));
|
||||||
|
$aActions = KTFolderActionUtil::getFolderInfoActionsForFolder($this->oFolder, $this->oUser);
|
||||||
|
$portlet->setActions($aActions,$this->sName);
|
||||||
|
$this->oPage->addPortlet($portlet);
|
||||||
|
|
||||||
|
$portlet = new KTActionPortlet(sprintf(_kt('Actions on this folder')));
|
||||||
|
$aActions = KTFolderActionUtil::getFolderActionsForFolder($oFolder, $this->oUser);
|
||||||
|
$portlet->setActions($aActions,null);
|
||||||
|
$this->oPage->addPortlet($portlet);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} else if ($this->browse_mode == 'lookup_value') {
|
||||||
|
// browsing by a lookup value
|
||||||
|
|
||||||
|
$this->editable = false;
|
||||||
|
|
||||||
|
// check the inputs
|
||||||
|
$field = KTUtil::arrayGet($_REQUEST, 'fField', null);
|
||||||
|
$oField = DocumentField::get($field);
|
||||||
|
if (PEAR::isError($oField) || ($oField == false)) {
|
||||||
|
$this->errorRedirectToMain('No Field selected.');
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
$value = KTUtil::arrayGet($_REQUEST, 'fValue', null);
|
||||||
|
$oValue = MetaData::get($value);
|
||||||
|
if (PEAR::isError($oValue) || ($oValue == false)) {
|
||||||
|
$this->errorRedirectToMain('No Value selected.');
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$this->oQuery = new ValueBrowseQuery($oField, $oValue);
|
||||||
|
$this->resultURL = KTUtil::addQueryString($_SERVER['PHP_SELF'],
|
||||||
|
sprintf('fBrowseMode=lookup_value&fField=%d&fValue=%d', $field, $value));
|
||||||
|
|
||||||
|
// setup breadcrumbs
|
||||||
|
$this->aBreadcrumbs =
|
||||||
|
array(
|
||||||
|
array('name' => _kt('Lookup Values'),
|
||||||
|
'url' => KTUtil::addQueryString($_SERVER['PHP_SELF'], 'action=selectField')),
|
||||||
|
array('name' => $oField->getName(),
|
||||||
|
'url' => KTUtil::addQueryString($_SERVER['PHP_SELF'], 'action=selectLookup&fField=' . $oField->getId())),
|
||||||
|
array('name' => $oValue->getName(),
|
||||||
|
'url' => KTUtil::addQueryString($_SERVER['PHP_SELF'], sprintf('fBrowseMode=lookup_value&fField=%d&fValue=%d', $field, $value))));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} else if ($this->browse_mode == 'document_type') {
|
||||||
|
// browsing by document type
|
||||||
|
|
||||||
|
|
||||||
|
$this->editable = false;
|
||||||
|
$doctype = KTUtil::arrayGet($_REQUEST, 'fType',null);
|
||||||
|
$oDocType = DocumentType::get($doctype);
|
||||||
|
if (PEAR::isError($oDocType) || ($oDocType == false)) {
|
||||||
|
$this->errorRedirectToMain('No Document Type selected.');
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->oQuery = new TypeBrowseQuery($oDocType);
|
||||||
|
|
||||||
|
// FIXME probably want to redirect to self + action=selectType
|
||||||
|
$this->aBreadcrumbs[] = array('name' => _kt('Document Types'), 'url' => KTUtil::addQueryString($_SERVER['PHP_SELF'], 'action=selectType'));
|
||||||
|
$this->aBreadcrumbs[] = array('name' => $oDocType->getName(), 'url' => KTUtil::addQueryString($_SERVER['PHP_SELF'], 'fBrowseMode=document_type&fType=' . $oDocType->getId()));
|
||||||
|
|
||||||
|
$this->resultURL = KTUtil::addQueryString($_SERVER['PHP_SELF'], sprintf('fType=%s&fBrowseMode=document_type', $doctype));;
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// FIXME what should we do if we can't initiate the browse? we "pretend" to have no perms.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function do_main() {
|
||||||
|
$oColumnRegistry =& KTColumnRegistry::getSingleton();
|
||||||
|
|
||||||
|
$collection = new AdvancedCollection;
|
||||||
|
$collection->addColumns($oColumnRegistry->getColumnsForView('ktcore.views.browse'));
|
||||||
|
|
||||||
|
$aOptions = $collection->getEnvironOptions(); // extract data from the environment
|
||||||
|
$aOptions['result_url'] = $this->resultURL;
|
||||||
|
$aOptions['is_browse'] = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$collection->setOptions($aOptions);
|
||||||
|
$collection->setQueryObject($this->oQuery);
|
||||||
|
$collection->setColumnOptions('ktcore.columns.selection', array(
|
||||||
|
'rangename' => 'selection',
|
||||||
|
'show_folders' => true,
|
||||||
|
'show_documents' => true,
|
||||||
|
));
|
||||||
|
|
||||||
|
// get bulk actions
|
||||||
|
$aBulkActions = KTBulkActionUtil::getAllBulkActions();
|
||||||
|
|
||||||
|
$oTemplating =& KTTemplating::getSingleton();
|
||||||
|
$oTemplate = $oTemplating->loadTemplate('kt3/browse');
|
||||||
|
$aTemplateData = array(
|
||||||
|
'context' => $this,
|
||||||
|
'collection' => $collection,
|
||||||
|
'browse_mode' => $this->browse_mode,
|
||||||
|
'isEditable' => $this->editable,
|
||||||
|
'bulkactions' => $aBulkActions,
|
||||||
|
'browseutil' => new KTBrowseUtil(),
|
||||||
|
'returnaction' => 'browse',
|
||||||
|
);
|
||||||
|
if ($this->oFolder) {
|
||||||
|
$aTemplateData['returndata'] = $this->oFolder->getId();
|
||||||
|
}
|
||||||
|
return $oTemplate->render($aTemplateData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function do_selectField() {
|
||||||
|
$aFields = DocumentField::getList('has_lookup = 1');
|
||||||
|
|
||||||
|
if (empty($aFields)) {
|
||||||
|
$this->errorRedirectToMain(_kt('No lookup fields available.'));
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
$_REQUEST['fBrowseMode'] = 'lookup_value';
|
||||||
|
|
||||||
|
$oTemplating =& KTTemplating::getSingleton();
|
||||||
|
$oTemplate = $oTemplating->loadTemplate('kt3/browse_lookup_selection');
|
||||||
|
$aTemplateData = array(
|
||||||
|
'context' => $this,
|
||||||
|
'fields' => $aFields,
|
||||||
|
);
|
||||||
|
return $oTemplate->render($aTemplateData);
|
||||||
|
}
|
||||||
|
|
||||||
|
function do_selectLookup() {
|
||||||
|
$field = KTUtil::arrayGet($_REQUEST, 'fField', null);
|
||||||
|
$oField = DocumentField::get($field);
|
||||||
|
if (PEAR::isError($oField) || ($oField == false) || (!$oField->getHasLookup())) {
|
||||||
|
$this->errorRedirectToMain('No Field selected.');
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
$_REQUEST['fBrowseMode'] = 'lookup_value';
|
||||||
|
|
||||||
|
$aValues = MetaData::getByDocumentField($oField);
|
||||||
|
|
||||||
|
$oTemplating =& KTTemplating::getSingleton();
|
||||||
|
$oTemplate = $oTemplating->loadTemplate('kt3/browse_lookup_value');
|
||||||
|
$aTemplateData = array(
|
||||||
|
'context' => $this,
|
||||||
|
'oField' => $oField,
|
||||||
|
'values' => $aValues,
|
||||||
|
);
|
||||||
|
return $oTemplate->render($aTemplateData);
|
||||||
|
}
|
||||||
|
|
||||||
|
function do_selectType() {
|
||||||
|
$aTypes = DocumentType::getList();
|
||||||
|
// FIXME what is the error message?
|
||||||
|
|
||||||
|
$_REQUEST['fBrowseMode'] = 'document_type';
|
||||||
|
|
||||||
|
if (empty($aTypes)) {
|
||||||
|
$this->errorRedirectToMain('No document types available.');
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
$oTemplating =& KTTemplating::getSingleton();
|
||||||
|
$oTemplate = $oTemplating->loadTemplate('kt3/browse_types');
|
||||||
|
$aTemplateData = array(
|
||||||
|
'context' => $this,
|
||||||
|
'document_types' => $aTypes,
|
||||||
|
);
|
||||||
|
return $oTemplate->render($aTemplateData);
|
||||||
|
}
|
||||||
|
|
||||||
|
function do_enableAdminMode() {
|
||||||
|
$iDocumentId = KTUtil::arrayGet($_REQUEST, 'fDocumentId');
|
||||||
|
$iFolderId = KTUtil::arrayGet($_REQUEST, 'fFolderId');
|
||||||
|
if ($iDocumentId) {
|
||||||
|
$oDocument = Document::get($iDocumentId);
|
||||||
|
if (PEAR::isError($oDocument) || ($oDocument === false)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$iFolderId = $oDocument->getFolderId();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Permission::userIsSystemAdministrator() && !Permission::isUnitAdministratorForFolder($this->oUser, $iFolderId)) {
|
||||||
|
$this->errorRedirectToMain(_kt('You are not an administrator'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// log this entry
|
||||||
|
$oLogEntry =& KTUserHistory::createFromArray(array(
|
||||||
|
'userid' => $this->oUser->getId(),
|
||||||
|
'datetime' => date('Y-m-d H:i:s', time()),
|
||||||
|
'actionnamespace' => 'ktcore.user_history.enable_admin_mode',
|
||||||
|
'comments' => 'Admin Mode enabled',
|
||||||
|
'sessionid' => $_SESSION['sessionID'],
|
||||||
|
));
|
||||||
|
$aOpts = array(
|
||||||
|
'redirect_to' => 'main',
|
||||||
|
'message' => _kt('Unable to log admin mode entry. Not activating admin mode.'),
|
||||||
|
);
|
||||||
|
$this->oValidator->notError($oLogEntry, $aOpts);
|
||||||
|
|
||||||
|
$_SESSION['adminmode'] = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ($_REQUEST['fDocumentId']) {
|
||||||
|
$_SESSION['KTInfoMessage'][] = _kt('Administrator mode enabled');
|
||||||
|
redirect(KTBrowseUtil::getUrlForDocument($iDocumentId));
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
if ($_REQUEST['fFolderId']) {
|
||||||
|
$this->successRedirectToMain(_kt('Administrator mode enabled'), sprintf('fFolderId=%d', $_REQUEST['fFolderId']));
|
||||||
|
}
|
||||||
|
$this->successRedirectToMain(_kt('Administrator mode enabled'));
|
||||||
|
}
|
||||||
|
|
||||||
|
function do_disableAdminMode() {
|
||||||
|
$iDocumentId = KTUtil::arrayGet($_REQUEST, 'fDocumentId');
|
||||||
|
$iFolderId = KTUtil::arrayGet($_REQUEST, 'fFolderId');
|
||||||
|
if ($iDocumentId) {
|
||||||
|
$oDocument = Document::get($iDocumentId);
|
||||||
|
if (PEAR::isError($oDocument) || ($oDocument === false)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$iFolderId = $oDocument->getFolderId();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Permission::userIsSystemAdministrator() && !Permission::isUnitAdministratorForFolder($this->oUser, $iFolderId)) {
|
||||||
|
$this->errorRedirectToMain(_kt('You are not an administrator'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// log this entry
|
||||||
|
$oLogEntry =& KTUserHistory::createFromArray(array(
|
||||||
|
'userid' => $this->oUser->getId(),
|
||||||
|
'datetime' => date('Y-m-d H:i:s', time()),
|
||||||
|
'actionnamespace' => 'ktcore.user_history.disable_admin_mode',
|
||||||
|
'comments' => 'Admin Mode disabled',
|
||||||
|
'sessionid' => $_SESSION['sessionID'],
|
||||||
|
));
|
||||||
|
$aOpts = array(
|
||||||
|
'redirect_to' => 'main',
|
||||||
|
'message' => _kt('Unable to log admin mode exit. Not de-activating admin mode.'),
|
||||||
|
);
|
||||||
|
$this->oValidator->notError($oLogEntry, $aOpts);
|
||||||
|
|
||||||
|
$_SESSION['adminmode'] = false;
|
||||||
|
if ($_REQUEST['fDocumentId']) {
|
||||||
|
$_SESSION['KTInfoMessage'][] = _kt('Administrator mode disabled');
|
||||||
|
redirect(KTBrowseUtil::getUrlForDocument($iDocumentId));
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
if ($_REQUEST['fFolderId']) {
|
||||||
|
$this->successRedirectToMain(_kt('Administrator mode disabled'), sprintf('fFolderId=%d', $_REQUEST['fFolderId']));
|
||||||
|
}
|
||||||
|
$this->successRedirectToMain(_kt('Administrator mode disabled'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$oDispatcher = new BrowseDispatcher();
|
||||||
|
$oDispatcher->dispatch();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
18
call_home.php
Normal file
18
call_home.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Data incoming format: <installation guid>|<user count>|<document count>|<KT version>|<KT edition>|<OS info>
|
||||||
|
*/
|
||||||
|
|
||||||
|
$data = isset($_REQUEST['system_info']) ? strip_tags($_REQUEST['system_info']) : '';
|
||||||
|
|
||||||
|
if(empty($data)){
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = 'var/system_info.txt';
|
||||||
|
$fp = fopen($file, 'a');
|
||||||
|
fwrite($fp, $data."\n");
|
||||||
|
fclose($fp);
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
?>
|
||||||
2
config/.htaccess
Normal file
2
config/.htaccess
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Order deny,allow
|
||||||
|
Deny from all
|
||||||
1
config/cache-path
Normal file
1
config/cache-path
Normal file
@ -0,0 +1 @@
|
|||||||
|
var/cache
|
||||||
1
config/config-path
Normal file
1
config/config-path
Normal file
@ -0,0 +1 @@
|
|||||||
|
/etc/knowledgetree-ce/config.ini
|
||||||
149
config/config.ini
Normal file
149
config/config.ini
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
; ----------------------------------------------------------------
|
||||||
|
; At a minimum, you may need to change some of settings in this
|
||||||
|
; db section.
|
||||||
|
; ----------------------------------------------------------------
|
||||||
|
|
||||||
|
[db]
|
||||||
|
; The Database Engine to use. Currently mysql is the only
|
||||||
|
; supported type.
|
||||||
|
dbType = mysql
|
||||||
|
|
||||||
|
; Database login details
|
||||||
|
dbHost = localhost
|
||||||
|
dbName = dms
|
||||||
|
dbUser = dms
|
||||||
|
dbPass = djw9281js
|
||||||
|
dbPort = default
|
||||||
|
|
||||||
|
dbAdminUser = dmsadmin
|
||||||
|
dbAdminPass = js9281djw
|
||||||
|
|
||||||
|
[KnowledgeTree]
|
||||||
|
|
||||||
|
; ----------------------------------------------------------------
|
||||||
|
; The options in this section should automatically be detected by
|
||||||
|
; KnowledgeTree. Please DO NOT set these manually if you do not
|
||||||
|
; need to, as you may introduce errors in your system.
|
||||||
|
; ----------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
; install path (file path)
|
||||||
|
;
|
||||||
|
; Leave as default to have it automatically detected.
|
||||||
|
;
|
||||||
|
fileSystemRoot = default
|
||||||
|
|
||||||
|
; Webserver name (host name)
|
||||||
|
;
|
||||||
|
; Leave as default to have it automatically detected.
|
||||||
|
;
|
||||||
|
serverName = default
|
||||||
|
|
||||||
|
; Whether ssl is enabled or not
|
||||||
|
;
|
||||||
|
; Leave as default to have it automatically detected.
|
||||||
|
;
|
||||||
|
sslEnabled = false
|
||||||
|
|
||||||
|
; Path to the web application from the root of the web site.
|
||||||
|
; If KT is at http://example.org/foo/, then rootUrl should be '/foo'
|
||||||
|
;
|
||||||
|
; Leave as default to have it automatically detected.
|
||||||
|
;
|
||||||
|
rootUrl = default
|
||||||
|
|
||||||
|
; Whether the platform supports PATH_INFO or not. Currently defaults to
|
||||||
|
; true, but later will attempt to determine somehow.
|
||||||
|
pathInfoSupport = default
|
||||||
|
|
||||||
|
; Where to look for binaries on your system. This defaults to the path
|
||||||
|
; set for your web server, which works well for Unix-like systems, but
|
||||||
|
; may need some changing for Windows systems.
|
||||||
|
execSearchPath = default
|
||||||
|
|
||||||
|
; Use new Dashboard.
|
||||||
|
; Defaults to true
|
||||||
|
useNewDashboard = default
|
||||||
|
|
||||||
|
; Which level of logging to use. DEBUG, INFO, WARN, ERROR
|
||||||
|
; Defaults to INFO
|
||||||
|
; logLevel = DEBUG
|
||||||
|
|
||||||
|
; The location of the mime magic file
|
||||||
|
; Defaults to /usr/share/file/magic
|
||||||
|
magicDatabase = default
|
||||||
|
|
||||||
|
[storage]
|
||||||
|
; By default uses KTOnDiskHashedStorageManager
|
||||||
|
; manager = KTOnDiskHashedStorageManager
|
||||||
|
manager = default
|
||||||
|
|
||||||
|
[ui]
|
||||||
|
|
||||||
|
; Main logo
|
||||||
|
;mainLogo = ${rootUrl}/resources/oemlogo.png
|
||||||
|
; the logo's width in pixels
|
||||||
|
;mainLogoWidth = 219px
|
||||||
|
; ALT text - for accessibility purposes.
|
||||||
|
;mainLogoTitle = ACME Knowledge Management Systems
|
||||||
|
; URL on the main logo
|
||||||
|
;mainLogoUrl = ${rootUrl}
|
||||||
|
; powered by kt logo
|
||||||
|
;powerLogo = ${rootUrl}/resources/powered-by-kt.png
|
||||||
|
; the logo's width in pixels
|
||||||
|
;powerLogoWidth = 130px
|
||||||
|
; ALT text - for accessibility purposes.
|
||||||
|
;powerLogoTitle = Powered by KnowledgeTree
|
||||||
|
|
||||||
|
; use the additional IE specific GIF theme overrides.
|
||||||
|
; using this means that arbitrary theme packs may not work without
|
||||||
|
; having GIF versions available.
|
||||||
|
; ieGIF = true
|
||||||
|
ieGIF = default
|
||||||
|
|
||||||
|
; Set to true to automatically refresh the page after the session would
|
||||||
|
; have expired.
|
||||||
|
automaticRefresh = default
|
||||||
|
|
||||||
|
; "dot" command location
|
||||||
|
dot = dot
|
||||||
|
|
||||||
|
[tweaks]
|
||||||
|
; If you want to enable PHP error logging to the log/php_error_log
|
||||||
|
; file, change the following to true
|
||||||
|
phpErrorLogFile = false
|
||||||
|
|
||||||
|
[urls]
|
||||||
|
; directories
|
||||||
|
varDirectory = ${fileSystemRoot}/var
|
||||||
|
logDirectory = ${varDirectory}/log
|
||||||
|
documentRoot = ${varDirectory}/Documents
|
||||||
|
uiDirectory = ${fileSystemRoot}/presentation/lookAndFeel/knowledgeTree
|
||||||
|
tmpDirectory = ${varDirectory}/tmp
|
||||||
|
|
||||||
|
;dedicated feed url
|
||||||
|
;dedicatedrsstitle = RSS Feed Title
|
||||||
|
;dedicatedrssurl =
|
||||||
|
|
||||||
|
; files
|
||||||
|
stopwordsFile = ${fileSystemRoot}/config/stopwords.txt
|
||||||
|
|
||||||
|
[session]
|
||||||
|
|
||||||
|
; Set to true to force sessions to come from the same IP address
|
||||||
|
; ipTracking = false
|
||||||
|
|
||||||
|
[export]
|
||||||
|
|
||||||
|
; encoding to use in bulk export plugin
|
||||||
|
; default is set to UTF-8
|
||||||
|
; encoding = cp1252
|
||||||
|
encoding = default
|
||||||
|
|
||||||
|
[cache]
|
||||||
|
;
|
||||||
|
; enable/disable the cache and set the cache location
|
||||||
|
;
|
||||||
|
cacheEnabled = true
|
||||||
|
cacheDirectory = ${varDirectory}/cache
|
||||||
|
cachePlugins = true
|
||||||
671
config/dmsDefaults.php
Normal file
671
config/dmsDefaults.php
Normal file
@ -0,0 +1,671 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Defines KnowledgeTree application defaults.
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): Guenter Roeck______________________________________
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
// stuff in the new installer section database upgrade fails without this
|
||||||
|
global $default;
|
||||||
|
|
||||||
|
if (defined('DMS_DEFAULTS_INCLUDED'))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
define('DMS_DEFAULTS_INCLUDED',1);
|
||||||
|
define('LATEST_WEBSERVICE_VERSION',2);
|
||||||
|
|
||||||
|
|
||||||
|
if (function_exists('apd_set_pprof_trace')) {
|
||||||
|
apd_set_pprof_trace();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default settings differ, we need some of these, so force the matter.
|
||||||
|
// Can be overridden here if actually necessary.
|
||||||
|
error_reporting(E_ALL & ~E_NOTICE);
|
||||||
|
ini_set('display_errors', '1');
|
||||||
|
ini_set('display_startup_errors', '1');
|
||||||
|
ini_set('magic_quotes_runtime', '0');
|
||||||
|
ini_set('arg_separator.output', '&');
|
||||||
|
|
||||||
|
$microtime_simple = explode(' ', microtime());
|
||||||
|
|
||||||
|
$_KT_starttime = (float) $microtime_simple[1] + (float) $microtime_simple[0];
|
||||||
|
unset($microtime_simple);
|
||||||
|
|
||||||
|
// If not defined, set KT_DIR based on my usual location in the tree
|
||||||
|
if (!defined('KT_DIR')) {
|
||||||
|
$rootLoc = realpath(dirname(__FILE__) . '/..');
|
||||||
|
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||||
|
$rootLoc = str_replace('\\','/',$rootLoc);
|
||||||
|
}
|
||||||
|
define('KT_DIR', $rootLoc);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!defined('KT_LIB_DIR')) {
|
||||||
|
define('KT_LIB_DIR', KT_DIR . '/lib');
|
||||||
|
}
|
||||||
|
|
||||||
|
// If not defined, set KT_STACK_DIR based on my usual location in the tree
|
||||||
|
// TODO: This needs to use a config.ini entry if available
|
||||||
|
if (!defined('KT_STACK_DIR')) {
|
||||||
|
$stackLoc = realpath(dirname(__FILE__) . '/../..');
|
||||||
|
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||||
|
$stackLoc = str_replace('\\','/',$stackLoc);
|
||||||
|
}
|
||||||
|
define('KT_STACK_DIR', $stackLoc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// PATH_SEPARATOR added in PHP 4.3.0
|
||||||
|
if (!defined('PATH_SEPARATOR')) {
|
||||||
|
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||||
|
define('PATH_SEPARATOR', ';');
|
||||||
|
} else {
|
||||||
|
define('PATH_SEPARATOR', ':');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once(KT_LIB_DIR . '/validation/customerror.php');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// {{{ prependPath()
|
||||||
|
function prependPath ($path) {
|
||||||
|
|
||||||
|
$include_path = ini_get('include_path');
|
||||||
|
ini_set('include_path', $path . PATH_SEPARATOR . $include_path);
|
||||||
|
}
|
||||||
|
// }}}
|
||||||
|
|
||||||
|
prependPath(KT_DIR . '/thirdparty/ZendFramework/library');
|
||||||
|
prependPath(KT_DIR . '/thirdparty/pear');
|
||||||
|
prependPath(KT_DIR . '/thirdparty/Smarty');
|
||||||
|
prependPath(KT_DIR . '/thirdparty/simpletest');
|
||||||
|
prependPath(KT_DIR . '/thirdparty/xmlrpc-2.2/lib');
|
||||||
|
prependPath(KT_DIR . '/ktapi');
|
||||||
|
prependPath(KT_DIR . '/search2');
|
||||||
|
require_once('PEAR.php');
|
||||||
|
|
||||||
|
// Give everyone access to legacy PHP functions
|
||||||
|
require_once(KT_LIB_DIR . '/util/legacy.inc');
|
||||||
|
|
||||||
|
// Give everyone access to KTUtil utility functions
|
||||||
|
require_once(KT_LIB_DIR . '/util/ktutil.inc');
|
||||||
|
|
||||||
|
require_once(KT_LIB_DIR . '/ktentity.inc');
|
||||||
|
|
||||||
|
require_once(KT_LIB_DIR . '/config/config.inc.php');
|
||||||
|
require_once(KT_DIR . '/search2/indexing/indexerCore.inc.php');
|
||||||
|
|
||||||
|
// {{{ KTInit
|
||||||
|
class KTInit {
|
||||||
|
|
||||||
|
// {{{ setupLogging()
|
||||||
|
function setupLogging () {
|
||||||
|
global $default;
|
||||||
|
$oKTConfig =& KTConfig::getSingleton();
|
||||||
|
if(!defined('APP_NAME')) {
|
||||||
|
define('APP_NAME', $oKTConfig->get('ui/appName', 'KnowledgeTree'));
|
||||||
|
}
|
||||||
|
|
||||||
|
define('KT_LOG4PHP_DIR', KT_DIR . '/thirdparty/apache-log4php/src/main/php' . DIRECTORY_SEPARATOR);
|
||||||
|
define('LOG4PHP_CONFIGURATION', KT_DIR . '/config/ktlog.ini');
|
||||||
|
define('LOG4PHP_DEFAULT_INIT_OVERRIDE', true);
|
||||||
|
|
||||||
|
require_once(KT_LOG4PHP_DIR . 'LoggerManager.php');
|
||||||
|
require_once(KT_LOG4PHP_DIR . 'LoggerPropertyConfigurator.php');
|
||||||
|
|
||||||
|
$configurator = new LoggerPropertyConfigurator();
|
||||||
|
$repository = LoggerManager::getLoggerRepository();
|
||||||
|
$properties = @parse_ini_file(LOG4PHP_CONFIGURATION);
|
||||||
|
$properties['log4php.appender.default'] = 'LoggerAppenderDailyFile';
|
||||||
|
$properties['log4php.appender.default.layout'] = 'LoggerPatternLayout';
|
||||||
|
$properties['log4php.appender.default.layout.conversionPattern'] = '%d{Y-m-d | H:i:s} | %p | %t | %r | %X{userid} | %X{db} | %c | %M | %m%n';
|
||||||
|
$properties['log4php.appender.default.datePattern'] = 'Y-m-d';
|
||||||
|
$logDir = $oKTConfig->get('urls/logDirectory');
|
||||||
|
$properties['log4php.appender.default.file'] = $logDir . '/kt%s.' . KTUtil::running_user() . '.log.txt';
|
||||||
|
|
||||||
|
// get the log level set in the configuration settings to override the level set in ktlog.ini
|
||||||
|
// for the default / main logging. Additional logging can be configured through the ini file
|
||||||
|
$logLevel = $oKTConfig->get('KnowledgeTree/logLevel');
|
||||||
|
$properties['log4php.rootLogger'] = $logLevel . ', default';
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
$configurator->doConfigureProperties($properties, $repository);
|
||||||
|
|
||||||
|
$userId = isset($_SESSION['userID'])?$_SESSION['userID']:'n/a';
|
||||||
|
|
||||||
|
LoggerMDC::put('userid', $userId);
|
||||||
|
LoggerMDC::put('db', $oKTConfig->get('db/dbName'));
|
||||||
|
|
||||||
|
$default->log = LoggerManager::getLogger('default');
|
||||||
|
$default->queryLog = LoggerManager::getLogger('sql');
|
||||||
|
$default->timerLog = LoggerManager::getLogger('timer');
|
||||||
|
$default->phpErrorLog = LoggerManager::getLogger('php');
|
||||||
|
}
|
||||||
|
// }}}
|
||||||
|
|
||||||
|
// {{{ setupI18n()
|
||||||
|
/**
|
||||||
|
* setupI18n
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function setupI18n () {
|
||||||
|
require_once(KT_LIB_DIR . '/i18n/i18nutil.inc.php');
|
||||||
|
require_once('HTTP.php');
|
||||||
|
global $default;
|
||||||
|
$language = KTUtil::arrayGet($_COOKIE, 'kt_language');
|
||||||
|
if ($language) {
|
||||||
|
$default->defaultLanguage = $language;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// }}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// {{{ cleanGlobals()
|
||||||
|
function cleanGlobals () {
|
||||||
|
/*
|
||||||
|
* Borrowed from TikiWiki
|
||||||
|
*
|
||||||
|
* Copyright (c) 2002-2004, Luis Argerich, Garland Foster,
|
||||||
|
* Eduardo Polidor, et. al.
|
||||||
|
*/
|
||||||
|
if (ini_get('register_globals')) {
|
||||||
|
$aGlobals = array($_ENV, $_GET, $_POST, $_COOKIE, $_SERVER);
|
||||||
|
foreach ($aGlobals as $superglob) {
|
||||||
|
foreach ($superglob as $key => $val) {
|
||||||
|
if (isset($GLOBALS[$key]) && $GLOBALS[$key] == $val) {
|
||||||
|
unset($GLOBALS[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// }}}
|
||||||
|
|
||||||
|
// {{{ cleanMagicQuotesItem()
|
||||||
|
function cleanMagicQuotesItem (&$var) {
|
||||||
|
if (is_array($var)) {
|
||||||
|
foreach ($var as $key => $val) {
|
||||||
|
$this->cleanMagicQuotesItem($var[$key]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// XXX: Make it look pretty
|
||||||
|
$var = stripslashes($var);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// }}}
|
||||||
|
|
||||||
|
// {{{ cleanMagicQuotes()
|
||||||
|
function cleanMagicQuotes () {
|
||||||
|
if (get_magic_quotes_gpc()) {
|
||||||
|
$this->cleanMagicQuotesItem($_GET);
|
||||||
|
$this->cleanMagicQuotesItem($_POST);
|
||||||
|
$this->cleanMagicQuotesItem($_REQUEST);
|
||||||
|
$this->cleanMagicQuotesItem($_COOKIE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// }}}
|
||||||
|
|
||||||
|
// {{{ setupServerVariables
|
||||||
|
function setupServerVariables() {
|
||||||
|
$oKTConfig =& KTConfig::getSingleton();
|
||||||
|
$bPathInfoSupport = $oKTConfig->get('KnowledgeTree/pathInfoSupport');
|
||||||
|
if ($bPathInfoSupport) {
|
||||||
|
// KTS-21: Some environments (FastCGI only?) don't set PATH_INFO
|
||||||
|
// correctly, but do set ORIG_PATH_INFO.
|
||||||
|
$path_info = KTUtil::arrayGet($_SERVER, 'PATH_INFO');
|
||||||
|
$orig_path_info = KTUtil::arrayGet($_SERVER, 'ORIG_PATH_INFO');
|
||||||
|
if (empty($path_info) && !empty($orig_path_info)) {
|
||||||
|
$_SERVER['PATH_INFO'] = strip_tags($_SERVER['ORIG_PATH_INFO']);
|
||||||
|
$_SERVER['PHP_SELF'] .= $_SERVER['PATH_INFO'];
|
||||||
|
}
|
||||||
|
$env_path_info = KTUtil::arrayGet($_SERVER, 'REDIRECT_kt_path_info');
|
||||||
|
if (empty($path_info) && !empty($env_path_info)) {
|
||||||
|
$_SERVER['PATH_INFO'] = strip_tags($env_path_info);
|
||||||
|
$_SERVER['PHP_SELF'] .= $_SERVER['PATH_INFO'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// KTS-50: IIS (and probably most non-Apache web servers) don't
|
||||||
|
// set REQUEST_URI. Fake it.
|
||||||
|
$request_uri = KTUtil::arrayGet($_SERVER, 'REQUEST_URI');
|
||||||
|
if (empty($request_uri)) {
|
||||||
|
$_SERVER['REQUEST_URI'] = strip_tags(KTUtil::addQueryString($_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING']));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
unset($_SERVER['PATH_INFO']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$script_name = strip_tags(KTUtil::arrayGet($_SERVER, 'SCRIPT_NAME'));
|
||||||
|
$php_self = strip_tags(KTUtil::arrayGet($_SERVER, 'PHP_SELF'));
|
||||||
|
|
||||||
|
$_SERVER['SCRIPT_NAME'] = $script_name;
|
||||||
|
$_SERVER['PHP_SELF'] = $php_self;
|
||||||
|
|
||||||
|
$kt_path_info = strip_tags(KTUtil::arrayGet($_REQUEST, 'kt_path_info'));
|
||||||
|
if (!empty($kt_path_info)) {
|
||||||
|
$_SERVER['PHP_SELF'] .= '?kt_path_info=' . $kt_path_info;
|
||||||
|
$_SERVER['PATH_INFO'] = $kt_path_info;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sServerName = $oKTConfig->get('KnowledgeTree/serverName');
|
||||||
|
$_SERVER['HTTP_HOST'] = $sServerName;
|
||||||
|
}
|
||||||
|
// }}}
|
||||||
|
|
||||||
|
// {{{ setupRandomSeed()
|
||||||
|
function setupRandomSeed () {
|
||||||
|
mt_srand(hexdec(substr(md5(microtime()), -8)) & 0x7fffffff);
|
||||||
|
}
|
||||||
|
// }}}
|
||||||
|
|
||||||
|
// {{{ handleInitError()
|
||||||
|
function handleInitError($oError) {
|
||||||
|
global $checkup;
|
||||||
|
$msg = $oError->toString();
|
||||||
|
|
||||||
|
if ($checkup === true) {
|
||||||
|
echo $msg;
|
||||||
|
exit(0);
|
||||||
|
//return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (KTUtil::arrayGet($_SERVER, 'REQUEST_METHOD')) {
|
||||||
|
session_start();
|
||||||
|
$_SESSION['sErrorMessage'] = $msg;
|
||||||
|
|
||||||
|
$url = KTUtil::kt_url().'/customerrorpage.php';
|
||||||
|
// Redirect to custom error page
|
||||||
|
header('Location: '.$url.$qs);
|
||||||
|
|
||||||
|
/* A lot of steps to display the error page ... are they really needed?
|
||||||
|
require_once(KT_LIB_DIR . '/dispatcher.inc.php');
|
||||||
|
$oDispatcher =new KTErrorDispatcher($oError);
|
||||||
|
$oDispatcher->dispatch();
|
||||||
|
*/
|
||||||
|
} else {
|
||||||
|
print $msg . "\n";
|
||||||
|
}
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
// }}}
|
||||||
|
|
||||||
|
static function detectMagicFile()
|
||||||
|
{
|
||||||
|
$knownPaths = array(
|
||||||
|
'/usr/share/file/magic', // the old default
|
||||||
|
'/etc/httpd/conf/magic', // fedora's location
|
||||||
|
'/etc/magic' // worst case scenario. Noticed this is sometimes empty and containing a reference to somewher else
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach($knownPaths as $path)
|
||||||
|
{
|
||||||
|
if (file_exists($path))
|
||||||
|
{
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return KT_DIR . '/config/magic';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static protected $handlerMapping = array(
|
||||||
|
E_WARNING=>'warn',
|
||||||
|
E_USER_WARNING=>'warn',
|
||||||
|
E_NOTICE=>'info',
|
||||||
|
E_USER_NOTICE=>'info',
|
||||||
|
E_ERROR=>'error',
|
||||||
|
E_USER_ERROR=>'error'
|
||||||
|
);
|
||||||
|
|
||||||
|
// {{{ handlePHPError()
|
||||||
|
static function handlePHPError($code, $message, $file, $line) {
|
||||||
|
global $default;
|
||||||
|
|
||||||
|
$priority = 'info';
|
||||||
|
if (array_key_exists($code, KTInit::$handlerMapping))
|
||||||
|
{
|
||||||
|
$priority = KTInit::$handlerMapping[$code];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($priority))
|
||||||
|
{
|
||||||
|
$priority = 'info';
|
||||||
|
}
|
||||||
|
|
||||||
|
$msg = $message . ' in ' . $file . ' at line ' . $line;
|
||||||
|
|
||||||
|
if (isset($default->phpErrorLog))
|
||||||
|
{
|
||||||
|
$default->phpErrorLog->$priority($msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
|
||||||
|
function catchFatalErrors()
|
||||||
|
{
|
||||||
|
ini_set('display_errors','On');
|
||||||
|
$phperror='><div id="phperror" style="display:none">';
|
||||||
|
ini_set('error_prepend_string',$phperror);
|
||||||
|
|
||||||
|
$CustomErrorPage = KTUtil::kt_url().'/customerrorpage.php';
|
||||||
|
|
||||||
|
$phperror='</div>><form name="catcher" action="'.$CustomErrorPage.'" method="post" ><input type="hidden" name="fatal" value=""></form>
|
||||||
|
<script> document.catcher.fatal.value = document.getElementById("phperror").innerHTML; document.catcher.submit();</script>';
|
||||||
|
ini_set('error_append_string',$phperror);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// {{{ guessRootUrl()
|
||||||
|
function guessRootUrl() {
|
||||||
|
$urlpath = $_SERVER['SCRIPT_NAME'];
|
||||||
|
$bFound = false;
|
||||||
|
$rootUrl = '';
|
||||||
|
while ($urlpath) {
|
||||||
|
if (file_exists(KT_DIR . '/' . $urlpath)) {
|
||||||
|
$bFound = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$i = strpos($urlpath, '/');
|
||||||
|
if ($i === false) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ($rootUrl)
|
||||||
|
{
|
||||||
|
$rootUrl .= '/';
|
||||||
|
}
|
||||||
|
$rootUrl .= substr($urlpath, 0, $i);
|
||||||
|
$urlpath = substr($urlpath, $i + 1);
|
||||||
|
}
|
||||||
|
if ($bFound) {
|
||||||
|
if ($rootUrl) {
|
||||||
|
$rootUrl = '/' . $rootUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the rootUrl contains KT_DIR then it is the full path and not relative to the apache document root
|
||||||
|
// We return an empty string which will work for all stack installs but might break source installs.
|
||||||
|
// However this situation should only crop up when running background scripts and can be avoided by setting
|
||||||
|
// the rootUrl in the config settings.
|
||||||
|
if(strpos($rootUrl, KT_DIR) !== false){
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return $rootUrl;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
// }}}
|
||||||
|
|
||||||
|
// {{{ getDynamicConfigSettings
|
||||||
|
//This function gets the intial config settings which can only be resolved by using php
|
||||||
|
function getDynamicConfigSettings()
|
||||||
|
{
|
||||||
|
$oKTConfig =& KTConfig::getSingleton();
|
||||||
|
|
||||||
|
// Override the config setting - KT_DIR is resolved on page load
|
||||||
|
$oKTConfig->setdefaultns('KnowledgeTree', 'fileSystemRoot', KT_DIR);
|
||||||
|
|
||||||
|
// Set ssl to enabled if using https - if the server variable is not set, allow the config setting to take precedence
|
||||||
|
if (array_key_exists('HTTPS', $_SERVER)) {
|
||||||
|
if (strtolower($_SERVER['HTTPS']) === 'on') {
|
||||||
|
$oKTConfig->setdefaultns('KnowledgeTree', 'sslEnabled', 'true');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$oKTConfig->setdefaultns('KnowledgeTree', 'serverName', $_SERVER['HTTP_HOST']);
|
||||||
|
|
||||||
|
// Check for the config setting before overriding with the resolved setting
|
||||||
|
$serverName = $oKTConfig->get('KnowledgeTree/serverName');
|
||||||
|
$rootUrl = $oKTConfig->get('KnowledgeTree/rootUrl');
|
||||||
|
$execSearchPath = $oKTConfig->get('KnowledgeTree/execSearchPath');
|
||||||
|
$magicDatabase = $oKTConfig->get('KnowledgeTree/magicDatabase');
|
||||||
|
|
||||||
|
// base server name
|
||||||
|
if(empty($serverName) || $serverName == 'default'){
|
||||||
|
$oKTConfig->setdefaultns('KnowledgeTree', 'serverName', KTUtil::getServerName());
|
||||||
|
}
|
||||||
|
|
||||||
|
// the sub directory or root url
|
||||||
|
if(empty($rootUrl) || $rootUrl == 'default'){
|
||||||
|
$oKTConfig->setdefaultns('KnowledgeTree', 'rootUrl', $this->guessRootUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
// path to find the executable binaries
|
||||||
|
if(empty($execSearchPath) || $execSearchPath == 'default'){
|
||||||
|
$oKTConfig->setdefaultns('KnowledgeTree', 'execSearchPath', $_SERVER['PATH']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// path to magic database
|
||||||
|
if(empty($magicDatabase) || $magicDatabase == 'default'){
|
||||||
|
$oKTConfig->setdefaultns('KnowledgeTree', 'magicDatabase', KTInit::detectMagicFile());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// }}}
|
||||||
|
|
||||||
|
// {{{ initConfig
|
||||||
|
function initConfig() {
|
||||||
|
global $default;
|
||||||
|
$oKTConfig = KTConfig::getSingleton();
|
||||||
|
|
||||||
|
// Override the config setting - KT_DIR is resolved on page load
|
||||||
|
$oKTConfig->setdefaultns('KnowledgeTree', 'fileSystemRoot', KT_DIR);
|
||||||
|
|
||||||
|
// TODO: refactor when all the config settings are stored in the database
|
||||||
|
// Check for the config cache
|
||||||
|
$use_cache = false;
|
||||||
|
$store_cache = true;
|
||||||
|
$cachePath = $oKTConfig->getCacheFilename();
|
||||||
|
if (file_exists($cachePath)) {
|
||||||
|
$configPath = $oKTConfig->getConfigFilename();
|
||||||
|
|
||||||
|
// This check can be removed once all config settings are in the database
|
||||||
|
// Check if the config file has been updated since the last time the cache file was generated.
|
||||||
|
$cachestat = stat($cachePath);
|
||||||
|
$configstat = stat($configPath);
|
||||||
|
$tval = 9;
|
||||||
|
if ($cachestat[$tval] > $configstat[$tval]) {
|
||||||
|
$use_cache = true;
|
||||||
|
$store_cache = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($use_cache) {
|
||||||
|
$use_cache = $oKTConfig->loadCache($cachePath);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(!isset($_SERVER['HTTP_HOST']) || empty($_SERVER['HTTP_HOST'])){
|
||||||
|
// If the http_host server variable is not set then the serverName gets set to localhost
|
||||||
|
// We don't want to store this setting so we set store_cache to false
|
||||||
|
$store_cache = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$use_cache) {
|
||||||
|
//Read in DB settings and config settings
|
||||||
|
$oKTConfig->readDBConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
$dbSetup = $oKTConfig->setupDB();
|
||||||
|
|
||||||
|
if(PEAR::isError($dbSetup))
|
||||||
|
{
|
||||||
|
/* We need to setup the language handler to display this error correctly */
|
||||||
|
$this->setupI18n();
|
||||||
|
$this->handleInitError($dbSetup);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read in the config settings from the database
|
||||||
|
// Create the global $default array
|
||||||
|
if(!$use_cache) $res = $oKTConfig->readConfig();
|
||||||
|
|
||||||
|
// Get default server url settings
|
||||||
|
$this->getDynamicConfigSettings();
|
||||||
|
|
||||||
|
if($store_cache && isset($cachePath)){
|
||||||
|
@touch($cachePath);
|
||||||
|
if (is_writable($cachePath)) {
|
||||||
|
$oKTConfig->createCache($cachePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// }}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// {{{ initTesting
|
||||||
|
function initTesting() {
|
||||||
|
$oKTConfig =& KTConfig::getSingleton();
|
||||||
|
$sConfigFile = trim(@file_get_contents(KT_DIR . '/config/test-config-path'));
|
||||||
|
if (empty($sConfigFile)) {
|
||||||
|
$sConfigFile = 'config/test.ini';
|
||||||
|
}
|
||||||
|
if (!KTUtil::isAbsolutePath($sConfigFile)) {
|
||||||
|
$sConfigFile = sprintf('%s/%s', KT_DIR, $sConfigFile);
|
||||||
|
}
|
||||||
|
if (!file_exists($sConfigFile)) {
|
||||||
|
$this->handleInitError(PEAR::raiseError('Test infrastructure not configured'));
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
$res = $oKTConfig->loadFile($sConfigFile);
|
||||||
|
if (PEAR::isError($res)) {
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
$_SESSION['userID'] = 1;
|
||||||
|
}
|
||||||
|
// }}}
|
||||||
|
}
|
||||||
|
// }}}
|
||||||
|
|
||||||
|
|
||||||
|
$KTInit = new KTInit();
|
||||||
|
$KTInit->initConfig();
|
||||||
|
$KTInit->setupI18n();
|
||||||
|
|
||||||
|
//====================================
|
||||||
|
|
||||||
|
define('KTLOG_CACHE',false);
|
||||||
|
|
||||||
|
if (isset($GLOBALS['kt_test'])) {
|
||||||
|
$KTInit->initTesting();
|
||||||
|
}
|
||||||
|
|
||||||
|
$oKTConfig = KTConfig::getSingleton();
|
||||||
|
|
||||||
|
if($oKTConfig->get('CustomErrorMessages/customerrormessages') == 'on')
|
||||||
|
{
|
||||||
|
$KTInit->catchFatalErrors();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (phpversion()<5){
|
||||||
|
|
||||||
|
$rootUrl = $KTInit->guessRootUrl();
|
||||||
|
$sErrorPage = 'http://'.$_SERVER['HTTP_HOST'].$rootUrl.'/'.'customerrorpage.php';
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
$_SESSION['sErrorMessage'] = 'KnowledgeTree now requires that PHP version 5 is installed. PHP version 4 is no longer supported.';
|
||||||
|
|
||||||
|
|
||||||
|
header('location:'. $sErrorPage ) ;
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
$KTInit->setupServerVariables();
|
||||||
|
|
||||||
|
// instantiate log
|
||||||
|
$loggingSupport = $KTInit->setupLogging();
|
||||||
|
|
||||||
|
// Send all PHP errors to a file (and maybe a window)
|
||||||
|
set_error_handler(array('KTInit', 'handlePHPError'));
|
||||||
|
|
||||||
|
|
||||||
|
$KTInit->setupRandomSeed();
|
||||||
|
|
||||||
|
$GLOBALS['KTRootUrl'] = $oKTConfig->get('KnowledgeTree/rootUrl');
|
||||||
|
|
||||||
|
require_once(KT_LIB_DIR . '/database/lookup.inc');
|
||||||
|
|
||||||
|
// table mapping entries
|
||||||
|
include('tableMappings.inc');
|
||||||
|
|
||||||
|
$default->systemVersion = trim(file_get_contents(KT_DIR . '/docs/VERSION.txt'));
|
||||||
|
$default->versionName = trim(file_get_contents(KT_DIR . '/docs/VERSION-NAME.txt'));
|
||||||
|
|
||||||
|
$KTInit->cleanGlobals();
|
||||||
|
$KTInit->cleanMagicQuotes();
|
||||||
|
|
||||||
|
// site map definition
|
||||||
|
require_once(KT_DIR . '/config/siteMap.inc');
|
||||||
|
|
||||||
|
require_once(KT_LIB_DIR . '/session/Session.inc');
|
||||||
|
require_once(KT_LIB_DIR . '/session/control.inc');
|
||||||
|
|
||||||
|
require_once(KT_LIB_DIR . '/plugins/pluginutil.inc.php');
|
||||||
|
|
||||||
|
if ($checkup !== true) {
|
||||||
|
// Replace function later
|
||||||
|
/* ** Get the page being loaded and load the plugins specific to the page ** */
|
||||||
|
$sScriptName = $GLOBALS['_SERVER']['SCRIPT_NAME'];
|
||||||
|
$sScript = basename($sScriptName);
|
||||||
|
$pos = strpos($sScript, '.');
|
||||||
|
$sType = substr($sScript, 0, $pos);
|
||||||
|
|
||||||
|
KTPluginUtil::loadPlugins($sType);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($checkup !== true) {
|
||||||
|
if (KTPluginUtil::pluginIsActive('ktdms.wintools')) {
|
||||||
|
$path = KTPluginUtil::getPluginPath('ktdms.wintools');
|
||||||
|
require_once($path . 'baobabkeyutil.inc.php');
|
||||||
|
$name = BaobabKeyUtil::getName();
|
||||||
|
if ($name) {
|
||||||
|
$default->versionName = sprintf('%s %s', $default->versionName, $name);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$default->versionName = $default->versionName.' '._kt('(Community Edition)');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!extension_loaded('mbstring'))
|
||||||
|
{
|
||||||
|
require_once(KT_LIB_DIR . '/mbstring.inc.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once(KT_LIB_DIR . '/templating/kt3template.inc.php');
|
||||||
|
$GLOBALS['main'] =new KTPage();
|
||||||
|
|
||||||
|
?>
|
||||||
4
config/ktlog.ini
Normal file
4
config/ktlog.ini
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
log4php.rootLogger = INFO, default
|
||||||
|
;log4php.logger.sql= DEBUG
|
||||||
|
;log4php.logger.timer= DEBUG
|
||||||
|
log4php.logger.php= ERROR
|
||||||
13136
config/magic
Normal file
13136
config/magic
Normal file
File diff suppressed because it is too large
Load Diff
83
config/siteMap.inc
Normal file
83
config/siteMap.inc
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Defines site mappings- actions, pages and permissions.
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): ______________________________________
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once(KT_LIB_DIR . '/session/SiteMap.inc');
|
||||||
|
$default->siteMap = new SiteMap(false);
|
||||||
|
|
||||||
|
// action, page, section, group with access, link text
|
||||||
|
|
||||||
|
// general pages
|
||||||
|
$default->siteMap->addPage('login', '/login.php', 'General', None, '');
|
||||||
|
|
||||||
|
// dashboard
|
||||||
|
$default->siteMap->addPage('dashboard', '/dashboard.php', 'General', Guest, 'dashboard');
|
||||||
|
|
||||||
|
// old dashboard
|
||||||
|
$default->siteMap->addPage('olddashboard', '/olddashboard.php', 'General', Guest, 'olddashboard');
|
||||||
|
// dashboard news
|
||||||
|
|
||||||
|
//pages for manage documents section
|
||||||
|
$default->siteMap->addPage('browse', '/browse.php', 'Manage Documents', Guest, _kt('browse documents'));
|
||||||
|
$default->siteMap->addPage('viewDocument', '/view.php', 'Manage Documents', Guest, _kt('View Document'), false);
|
||||||
|
$default->siteMap->addPage('editDocument', '/edit.php', 'Manage Documents', Guest, _kt('Edit Document'), false);
|
||||||
|
|
||||||
|
// pages for administration section
|
||||||
|
$default->siteMap->addDefaultPage('administration', '/admin.php', 'Administration', UnitAdmin, _kt('Administration'));
|
||||||
|
|
||||||
|
// pages for advanced search section
|
||||||
|
$default->siteMap->addDefaultPage('advancedSearch', '/search/advancedSearchBL.php', 'Advanced Search', Guest, _kt('Advanced Search'), true);
|
||||||
|
$default->siteMap->addPage('booleanSearch', '/search/booleanSearch.php', 'Boolean Search', Guest, _kt('Boolean Search'), false);
|
||||||
|
|
||||||
|
$default->siteMap->addSectionColour('Advanced Search', 'th', 'A1571B');
|
||||||
|
$default->siteMap->addSectionColour('Standard Search', 'th', 'A1571B');
|
||||||
|
|
||||||
|
// pages for prefs section
|
||||||
|
$default->siteMap->addDefaultPage('preferences', '/preferences.php', 'Preferences', User, _kt('Preferences'));
|
||||||
|
|
||||||
|
// pages for about section
|
||||||
|
$default->siteMap->addDefaultPage('aboutkt', '/about.php', 'About', Guest, _kt('About'));
|
||||||
|
|
||||||
|
// pages for Help section
|
||||||
|
$default->siteMap->addDefaultPage('help', '/presentation/lookAndFeel/knowledgeTree/help.php', 'Help', Guest, _kt('Help'));
|
||||||
|
|
||||||
|
// pages for logout section section
|
||||||
|
$default->siteMap->addDefaultPage('logout', '/presentation/logout.php', 'Logout', Guest, _kt('Logout'));
|
||||||
|
|
||||||
|
?>
|
||||||
544
config/stopwords.txt
Normal file
544
config/stopwords.txt
Normal file
@ -0,0 +1,544 @@
|
|||||||
|
a's
|
||||||
|
able
|
||||||
|
about
|
||||||
|
above
|
||||||
|
according
|
||||||
|
accordingly
|
||||||
|
across
|
||||||
|
actually
|
||||||
|
after
|
||||||
|
afterwards
|
||||||
|
again
|
||||||
|
against
|
||||||
|
ain't
|
||||||
|
all
|
||||||
|
allow
|
||||||
|
allows
|
||||||
|
almost
|
||||||
|
alone
|
||||||
|
along
|
||||||
|
already
|
||||||
|
also
|
||||||
|
although
|
||||||
|
always
|
||||||
|
am
|
||||||
|
among
|
||||||
|
amongst
|
||||||
|
an
|
||||||
|
and
|
||||||
|
another
|
||||||
|
any
|
||||||
|
anybody
|
||||||
|
anyhow
|
||||||
|
anyone
|
||||||
|
anything
|
||||||
|
anyway
|
||||||
|
anyways
|
||||||
|
anywhere
|
||||||
|
apart
|
||||||
|
appear
|
||||||
|
appreciate
|
||||||
|
appropriate
|
||||||
|
are
|
||||||
|
aren't
|
||||||
|
around
|
||||||
|
as
|
||||||
|
aside
|
||||||
|
ask
|
||||||
|
asking
|
||||||
|
associated
|
||||||
|
at
|
||||||
|
available
|
||||||
|
away
|
||||||
|
awfully
|
||||||
|
be
|
||||||
|
became
|
||||||
|
because
|
||||||
|
become
|
||||||
|
becomes
|
||||||
|
becoming
|
||||||
|
been
|
||||||
|
before
|
||||||
|
beforehand
|
||||||
|
behind
|
||||||
|
being
|
||||||
|
believe
|
||||||
|
below
|
||||||
|
beside
|
||||||
|
besides
|
||||||
|
best
|
||||||
|
better
|
||||||
|
between
|
||||||
|
beyond
|
||||||
|
both
|
||||||
|
brief
|
||||||
|
but
|
||||||
|
by
|
||||||
|
c'mon
|
||||||
|
c's
|
||||||
|
came
|
||||||
|
can
|
||||||
|
can't
|
||||||
|
cannot
|
||||||
|
cant
|
||||||
|
cause
|
||||||
|
causes
|
||||||
|
certain
|
||||||
|
certainly
|
||||||
|
changes
|
||||||
|
clearly
|
||||||
|
co
|
||||||
|
com
|
||||||
|
come
|
||||||
|
comes
|
||||||
|
concerning
|
||||||
|
consequently
|
||||||
|
consider
|
||||||
|
considering
|
||||||
|
contain
|
||||||
|
containing
|
||||||
|
contains
|
||||||
|
corresponding
|
||||||
|
could
|
||||||
|
couldn't
|
||||||
|
course
|
||||||
|
currently
|
||||||
|
definitely
|
||||||
|
described
|
||||||
|
despite
|
||||||
|
did
|
||||||
|
didn't
|
||||||
|
different
|
||||||
|
do
|
||||||
|
does
|
||||||
|
doesn't
|
||||||
|
doing
|
||||||
|
don't
|
||||||
|
done
|
||||||
|
down
|
||||||
|
downwards
|
||||||
|
during
|
||||||
|
each
|
||||||
|
edu
|
||||||
|
eg
|
||||||
|
eight
|
||||||
|
either
|
||||||
|
else
|
||||||
|
elsewhere
|
||||||
|
enough
|
||||||
|
entirely
|
||||||
|
especially
|
||||||
|
et
|
||||||
|
etc
|
||||||
|
even
|
||||||
|
ever
|
||||||
|
every
|
||||||
|
everybody
|
||||||
|
everyone
|
||||||
|
everything
|
||||||
|
everywhere
|
||||||
|
ex
|
||||||
|
exactly
|
||||||
|
example
|
||||||
|
except
|
||||||
|
far
|
||||||
|
few
|
||||||
|
fifth
|
||||||
|
first
|
||||||
|
five
|
||||||
|
followed
|
||||||
|
following
|
||||||
|
follows
|
||||||
|
for
|
||||||
|
former
|
||||||
|
formerly
|
||||||
|
forth
|
||||||
|
four
|
||||||
|
from
|
||||||
|
further
|
||||||
|
furthermore
|
||||||
|
get
|
||||||
|
gets
|
||||||
|
getting
|
||||||
|
given
|
||||||
|
gives
|
||||||
|
go
|
||||||
|
goes
|
||||||
|
going
|
||||||
|
gone
|
||||||
|
got
|
||||||
|
gotten
|
||||||
|
greetings
|
||||||
|
had
|
||||||
|
hadn't
|
||||||
|
happens
|
||||||
|
hardly
|
||||||
|
has
|
||||||
|
hasn't
|
||||||
|
have
|
||||||
|
haven't
|
||||||
|
having
|
||||||
|
he
|
||||||
|
he's
|
||||||
|
hello
|
||||||
|
help
|
||||||
|
hence
|
||||||
|
her
|
||||||
|
here
|
||||||
|
here's
|
||||||
|
hereafter
|
||||||
|
hereby
|
||||||
|
herein
|
||||||
|
hereupon
|
||||||
|
hers
|
||||||
|
herself
|
||||||
|
hi
|
||||||
|
him
|
||||||
|
himself
|
||||||
|
his
|
||||||
|
hither
|
||||||
|
hopefully
|
||||||
|
how
|
||||||
|
howbeit
|
||||||
|
however
|
||||||
|
i'd
|
||||||
|
i'll
|
||||||
|
i'm
|
||||||
|
i've
|
||||||
|
ie
|
||||||
|
if
|
||||||
|
ignored
|
||||||
|
immediate
|
||||||
|
in
|
||||||
|
inasmuch
|
||||||
|
inc
|
||||||
|
indeed
|
||||||
|
indicate
|
||||||
|
indicated
|
||||||
|
indicates
|
||||||
|
inner
|
||||||
|
insofar
|
||||||
|
instead
|
||||||
|
into
|
||||||
|
inward
|
||||||
|
is
|
||||||
|
isn't
|
||||||
|
it
|
||||||
|
it'd
|
||||||
|
it'll
|
||||||
|
it's
|
||||||
|
its
|
||||||
|
itself
|
||||||
|
just
|
||||||
|
keep
|
||||||
|
keeps
|
||||||
|
kept
|
||||||
|
know
|
||||||
|
knows
|
||||||
|
known
|
||||||
|
last
|
||||||
|
lately
|
||||||
|
later
|
||||||
|
latter
|
||||||
|
latterly
|
||||||
|
least
|
||||||
|
less
|
||||||
|
lest
|
||||||
|
let
|
||||||
|
let's
|
||||||
|
like
|
||||||
|
liked
|
||||||
|
likely
|
||||||
|
little
|
||||||
|
look
|
||||||
|
looking
|
||||||
|
looks
|
||||||
|
ltd
|
||||||
|
mainly
|
||||||
|
many
|
||||||
|
may
|
||||||
|
maybe
|
||||||
|
me
|
||||||
|
mean
|
||||||
|
meanwhile
|
||||||
|
merely
|
||||||
|
might
|
||||||
|
more
|
||||||
|
moreover
|
||||||
|
most
|
||||||
|
mostly
|
||||||
|
much
|
||||||
|
must
|
||||||
|
my
|
||||||
|
myself
|
||||||
|
name
|
||||||
|
namely
|
||||||
|
nd
|
||||||
|
near
|
||||||
|
nearly
|
||||||
|
necessary
|
||||||
|
need
|
||||||
|
needs
|
||||||
|
neither
|
||||||
|
never
|
||||||
|
nevertheless
|
||||||
|
new
|
||||||
|
next
|
||||||
|
nine
|
||||||
|
no
|
||||||
|
nobody
|
||||||
|
non
|
||||||
|
none
|
||||||
|
noone
|
||||||
|
nor
|
||||||
|
normally
|
||||||
|
not
|
||||||
|
nothing
|
||||||
|
novel
|
||||||
|
now
|
||||||
|
nowhere
|
||||||
|
obviously
|
||||||
|
of
|
||||||
|
off
|
||||||
|
often
|
||||||
|
oh
|
||||||
|
ok
|
||||||
|
okay
|
||||||
|
old
|
||||||
|
on
|
||||||
|
once
|
||||||
|
one
|
||||||
|
ones
|
||||||
|
only
|
||||||
|
onto
|
||||||
|
or
|
||||||
|
other
|
||||||
|
others
|
||||||
|
otherwise
|
||||||
|
ought
|
||||||
|
our
|
||||||
|
ours
|
||||||
|
ourselves
|
||||||
|
out
|
||||||
|
outside
|
||||||
|
over
|
||||||
|
overall
|
||||||
|
own
|
||||||
|
particular
|
||||||
|
particularly
|
||||||
|
per
|
||||||
|
perhaps
|
||||||
|
placed
|
||||||
|
please
|
||||||
|
plus
|
||||||
|
possible
|
||||||
|
presumably
|
||||||
|
probably
|
||||||
|
provides
|
||||||
|
que
|
||||||
|
quite
|
||||||
|
qv
|
||||||
|
rather
|
||||||
|
rd
|
||||||
|
re
|
||||||
|
really
|
||||||
|
reasonably
|
||||||
|
regarding
|
||||||
|
regardless
|
||||||
|
regards
|
||||||
|
relatively
|
||||||
|
respectively
|
||||||
|
right
|
||||||
|
said
|
||||||
|
same
|
||||||
|
saw
|
||||||
|
say
|
||||||
|
saying
|
||||||
|
says
|
||||||
|
second
|
||||||
|
secondly
|
||||||
|
see
|
||||||
|
seeing
|
||||||
|
seem
|
||||||
|
seemed
|
||||||
|
seeming
|
||||||
|
seems
|
||||||
|
seen
|
||||||
|
self
|
||||||
|
selves
|
||||||
|
sensible
|
||||||
|
sent
|
||||||
|
serious
|
||||||
|
seriously
|
||||||
|
seven
|
||||||
|
several
|
||||||
|
shall
|
||||||
|
she
|
||||||
|
should
|
||||||
|
shouldn't
|
||||||
|
since
|
||||||
|
six
|
||||||
|
so
|
||||||
|
some
|
||||||
|
somebody
|
||||||
|
somehow
|
||||||
|
someone
|
||||||
|
something
|
||||||
|
sometime
|
||||||
|
sometimes
|
||||||
|
somewhat
|
||||||
|
somewhere
|
||||||
|
soon
|
||||||
|
sorry
|
||||||
|
specified
|
||||||
|
specify
|
||||||
|
specifying
|
||||||
|
still
|
||||||
|
sub
|
||||||
|
such
|
||||||
|
sup
|
||||||
|
sure
|
||||||
|
t's
|
||||||
|
take
|
||||||
|
taken
|
||||||
|
tell
|
||||||
|
tends
|
||||||
|
th
|
||||||
|
than
|
||||||
|
thank
|
||||||
|
thanks
|
||||||
|
thanx
|
||||||
|
that
|
||||||
|
that's
|
||||||
|
thats
|
||||||
|
the
|
||||||
|
their
|
||||||
|
theirs
|
||||||
|
them
|
||||||
|
themselves
|
||||||
|
then
|
||||||
|
thence
|
||||||
|
there
|
||||||
|
there's
|
||||||
|
thereafter
|
||||||
|
thereby
|
||||||
|
therefore
|
||||||
|
therein
|
||||||
|
theres
|
||||||
|
thereupon
|
||||||
|
these
|
||||||
|
they
|
||||||
|
they'd
|
||||||
|
they'll
|
||||||
|
they're
|
||||||
|
they've
|
||||||
|
think
|
||||||
|
third
|
||||||
|
this
|
||||||
|
thorough
|
||||||
|
thoroughly
|
||||||
|
those
|
||||||
|
though
|
||||||
|
three
|
||||||
|
through
|
||||||
|
throughout
|
||||||
|
thru
|
||||||
|
thus
|
||||||
|
to
|
||||||
|
together
|
||||||
|
too
|
||||||
|
took
|
||||||
|
toward
|
||||||
|
towards
|
||||||
|
tried
|
||||||
|
tries
|
||||||
|
truly
|
||||||
|
try
|
||||||
|
trying
|
||||||
|
twice
|
||||||
|
two
|
||||||
|
un
|
||||||
|
under
|
||||||
|
unfortunately
|
||||||
|
unless
|
||||||
|
unlikely
|
||||||
|
until
|
||||||
|
unto
|
||||||
|
up
|
||||||
|
upon
|
||||||
|
us
|
||||||
|
use
|
||||||
|
used
|
||||||
|
useful
|
||||||
|
uses
|
||||||
|
using
|
||||||
|
usually
|
||||||
|
value
|
||||||
|
various
|
||||||
|
very
|
||||||
|
via
|
||||||
|
viz
|
||||||
|
vs
|
||||||
|
want
|
||||||
|
wants
|
||||||
|
was
|
||||||
|
wasn't
|
||||||
|
way
|
||||||
|
we
|
||||||
|
we'd
|
||||||
|
we'll
|
||||||
|
we're
|
||||||
|
we've
|
||||||
|
welcome
|
||||||
|
well
|
||||||
|
went
|
||||||
|
were
|
||||||
|
weren't
|
||||||
|
what
|
||||||
|
what's
|
||||||
|
whatever
|
||||||
|
when
|
||||||
|
whence
|
||||||
|
whenever
|
||||||
|
where
|
||||||
|
where's
|
||||||
|
whereafter
|
||||||
|
whereas
|
||||||
|
whereby
|
||||||
|
wherein
|
||||||
|
whereupon
|
||||||
|
wherever
|
||||||
|
whether
|
||||||
|
which
|
||||||
|
while
|
||||||
|
whither
|
||||||
|
who
|
||||||
|
who's
|
||||||
|
whoever
|
||||||
|
whole
|
||||||
|
whom
|
||||||
|
whose
|
||||||
|
why
|
||||||
|
will
|
||||||
|
willing
|
||||||
|
wish
|
||||||
|
with
|
||||||
|
within
|
||||||
|
without
|
||||||
|
won't
|
||||||
|
wonder
|
||||||
|
would
|
||||||
|
would
|
||||||
|
wouldn't
|
||||||
|
yes
|
||||||
|
yet
|
||||||
|
you
|
||||||
|
you'd
|
||||||
|
you'll
|
||||||
|
you're
|
||||||
|
you've
|
||||||
|
your
|
||||||
|
yours
|
||||||
|
yourself
|
||||||
|
yourselves
|
||||||
|
zero
|
||||||
171
config/tableMappings.inc
Normal file
171
config/tableMappings.inc
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Stores the table mappings.
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): ______________________________________
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Table mappings
|
||||||
|
// session information
|
||||||
|
$default->sessions_table = 'active_sessions';
|
||||||
|
//data types table
|
||||||
|
$default->data_types_table ='data_types';
|
||||||
|
// document type fields
|
||||||
|
$default->document_fields_table = 'document_fields';
|
||||||
|
$default->fieldsets_table = 'fieldsets';
|
||||||
|
// links document
|
||||||
|
$default->document_fields_link_table = 'document_fields_link';
|
||||||
|
// document subscriptions
|
||||||
|
$default->document_subscriptions_table = 'document_subscriptions';
|
||||||
|
// document transaction types
|
||||||
|
$default->transaction_types_table = 'document_transaction_types_lookup';
|
||||||
|
// document transactions
|
||||||
|
$default->document_transactions_table = 'document_transactions';
|
||||||
|
// links document types to document type fields
|
||||||
|
$default->document_type_fields_table = 'document_type_fields_link';
|
||||||
|
// links document types to document type fields
|
||||||
|
$default->document_type_fieldsets_table = 'document_type_fieldsets_link';
|
||||||
|
// document type information
|
||||||
|
$default->document_types_table = 'document_types_lookup';
|
||||||
|
// stores documents
|
||||||
|
$default->documents_table = 'documents';
|
||||||
|
//link folders to doc types
|
||||||
|
$default->folder_doctypes_table = 'folder_doctypes_link';
|
||||||
|
// stores folder subscriptions
|
||||||
|
$default->folder_subscriptions_table = 'folder_subscriptions';
|
||||||
|
// stores folders
|
||||||
|
$default->folders_table = 'folders';
|
||||||
|
// stores group information
|
||||||
|
$default->groups_table = 'groups_lookup';
|
||||||
|
// links groups to units
|
||||||
|
$default->groups_units_table = 'groups_units_link';
|
||||||
|
// links -- DEPRECATED
|
||||||
|
//$default->quicklinks_table = 'links';
|
||||||
|
// Table with metadata
|
||||||
|
$default->metadata_table = 'metadata_lookup';
|
||||||
|
// Table with mime info
|
||||||
|
$default->mimetypes_table = 'mime_types';
|
||||||
|
// dashboard news table
|
||||||
|
$default->news_table = 'news';
|
||||||
|
// organisation information
|
||||||
|
$default->organisations_table = 'organisations_lookup';
|
||||||
|
// stores role information (name and access)
|
||||||
|
$default->roles_table = 'roles';
|
||||||
|
// sitemap access classes
|
||||||
|
$default->site_access_table = 'site_access_lookup';
|
||||||
|
// sitemap sections
|
||||||
|
$default->site_sections_table = 'site_sections_lookup';
|
||||||
|
// sitemap definition
|
||||||
|
$default->sitemap_table = 'sitemap';
|
||||||
|
// stores default system settings
|
||||||
|
$default->system_settings_table = 'system_settings';
|
||||||
|
// Table with discussion threads
|
||||||
|
$default->discussion_threads_table = 'discussion_threads';
|
||||||
|
// Table with discussion comments
|
||||||
|
$default->discussion_comments_table = 'discussion_comments';
|
||||||
|
// Table with unit information
|
||||||
|
$default->units_table = 'units_lookup';
|
||||||
|
// Table with unit organisation link tables
|
||||||
|
$default->units_organisations_table = 'units_organisations_link';
|
||||||
|
// Table with user info
|
||||||
|
$default->users_table = 'users';
|
||||||
|
// links groups to users
|
||||||
|
$default->users_groups_table = 'users_groups_link';
|
||||||
|
// Table with web documents info for web publishing
|
||||||
|
$default->web_documents_table = 'web_documents';
|
||||||
|
// Table with web documents info for web publishing
|
||||||
|
$default->web_documents_status_table = 'web_documents_status_lookup';
|
||||||
|
// stores websites for web publishing
|
||||||
|
$default->web_sites_table = 'web_sites';
|
||||||
|
//stores help text
|
||||||
|
$default->help_table = 'help';
|
||||||
|
$default->document_text_table = 'document_text';
|
||||||
|
$default->document_link_table = 'document_link';
|
||||||
|
// archive settings
|
||||||
|
$default->document_archiving_table = 'document_archiving_link';
|
||||||
|
$default->archiving_type_lookup_table = 'archiving_type_lookup';
|
||||||
|
$default->archiving_settings_table = 'archiving_settings';
|
||||||
|
$default->time_period_table = 'time_period';
|
||||||
|
$default->time_unit_lookup_table = 'time_unit_lookup';
|
||||||
|
$default->archive_restoration_table = 'archive_restoration_request';
|
||||||
|
$default->status_table = 'status_lookup';
|
||||||
|
$default->search_permissions_table = 'search_document_user_link';
|
||||||
|
$default->document_link_types_table = 'document_link_types';
|
||||||
|
$default->upgrades_table = 'upgrades';
|
||||||
|
$default->help_replacement_table = 'help_replacement';
|
||||||
|
$default->permissions_table = 'permissions';
|
||||||
|
$default->permission_objects_table = 'permission_objects';
|
||||||
|
$default->permission_descriptors_table = 'permission_descriptors';
|
||||||
|
$default->permission_assignments_table = 'permission_assignments';
|
||||||
|
$default->permission_descriptor_groups_table = 'permission_descriptor_groups';
|
||||||
|
$default->permission_descriptor_roles_table = 'permission_descriptor_roles';
|
||||||
|
$default->permission_descriptor_users_table = 'permission_descriptor_users';
|
||||||
|
$default->permission_lookups_table = 'permission_lookups';
|
||||||
|
$default->permission_lookup_assignments_table = 'permission_lookup_assignments';
|
||||||
|
$default->groups_groups_table = 'groups_groups_link';
|
||||||
|
$default->metadata_treenode_table = 'metadata_lookup_tree';
|
||||||
|
$default->metadata_condition_table = 'metadata_lookup_condition';
|
||||||
|
$default->md_condition_table = 'metadata_lookup_condition';
|
||||||
|
$default->md_condition_chain_table = 'metadata_lookup_condition_chain';
|
||||||
|
$default->field_orders_table = 'field_orders';
|
||||||
|
$default->workflows_table = 'workflows';
|
||||||
|
$default->workflow_states_table = 'workflow_states';
|
||||||
|
$default->workflow_transitions_table = 'workflow_transitions';
|
||||||
|
$default->workflow_state_transitions_table = 'workflow_state_transitions';
|
||||||
|
$default->workflow_documents_table = 'workflow_documents';
|
||||||
|
$default->workflow_actions_table = 'workflow_actions';
|
||||||
|
$default->workflow_state_actions_table = 'workflow_state_actions';
|
||||||
|
$default->field_value_instances_table = 'field_value_instances';
|
||||||
|
$default->field_behaviours_table = 'field_behaviours';
|
||||||
|
$default->field_behaviour_options_table = 'field_behaviour_options';
|
||||||
|
$default->document_transaction_text_table = 'document_transaction_text';
|
||||||
|
$default->document_searchable_text_table = 'document_searchable_text';
|
||||||
|
$default->saved_searches_table = 'saved_searches';
|
||||||
|
$default->permission_dynamic_conditions_table = 'permission_dynamic_conditions';
|
||||||
|
$default->permission_dynamic_assignments_table = 'permission_dynamic_assignments';
|
||||||
|
$default->notifications_table = 'notifications';
|
||||||
|
$default->authentication_sources_table = 'authentication_sources';
|
||||||
|
$default->dashlet_disable_table = 'dashlet_disables';
|
||||||
|
$default->role_allocations_table = 'role_allocations';
|
||||||
|
$default->document_role_allocations_table = 'document_role_allocations';
|
||||||
|
$default->plugins_table = 'plugins';
|
||||||
|
$default->document_metadata_version_table = 'document_metadata_version';
|
||||||
|
$default->document_content_version_table = 'document_content_version';
|
||||||
|
$default->trigger_selection_table = 'trigger_selection';
|
||||||
|
$default->type_workflow_map_table = 'type_workflow_map';
|
||||||
|
$default->folder_workflow_map_table = 'folder_workflow_map';
|
||||||
|
$default->workflow_state_permission_assignments_table = 'workflow_state_permission_assignments';
|
||||||
|
?>
|
||||||
10
config/test.ini
Normal file
10
config/test.ini
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[db]
|
||||||
|
; The Database Engine to use. Currently mysql is the only
|
||||||
|
; supported type.
|
||||||
|
dbType = mysql
|
||||||
|
|
||||||
|
dbHost = localhost
|
||||||
|
dbName = dms-test
|
||||||
|
dbUser = dmsadmin
|
||||||
|
dbPass = js9281djw
|
||||||
|
dbPort = default
|
||||||
167
control.php
Normal file
167
control.php
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): ______________________________________
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
// check if system has been installed
|
||||||
|
require_once("setup/wizard/installUtil.php");
|
||||||
|
// Check if system has been installed
|
||||||
|
$iu = new InstallUtil();
|
||||||
|
if(!$iu->isSystemInstalled()) {
|
||||||
|
$iu->redirect("setup/wizard");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// main library routines and defaults
|
||||||
|
require_once('config/dmsDefaults.php');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller page -- controls the web application by responding to a set of
|
||||||
|
* defined actions. The controller performs session handling, page-level
|
||||||
|
* authentication and forwards the request to the appropriate handling
|
||||||
|
* page.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// -------------------------------
|
||||||
|
// page start
|
||||||
|
// -------------------------------
|
||||||
|
|
||||||
|
$action = $_REQUEST['action'];
|
||||||
|
|
||||||
|
if ($action != 'login') {
|
||||||
|
|
||||||
|
// check the session, but don't redirect if the check fails
|
||||||
|
$ret = checkSessionAndRedirect(false);
|
||||||
|
if ($ret === true) {
|
||||||
|
//get around the problem with search
|
||||||
|
if (strcmp($_REQUEST['fForStandardSearch'], 'yes') == 0) {
|
||||||
|
$action = 'standardSearch';
|
||||||
|
} else if (!isset($action)) {
|
||||||
|
// session check succeeds, so default action should be the dashboard if no action was specified
|
||||||
|
$action = 'dashboard';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// session check fails, so default action should be the login form if no action was specified
|
||||||
|
$oKTConfig = KTConfig::getSingleton();
|
||||||
|
$dest = 'login';
|
||||||
|
if ($oKTConfig->get('allowAnonymousLogin', false)) { $dest = 'dashboard'; }
|
||||||
|
|
||||||
|
if (!isset($action)) {
|
||||||
|
$action = $dest;
|
||||||
|
} elseif ($action <> $dest) {
|
||||||
|
// we have a controller link and auth has failed, so redirect to the login page
|
||||||
|
// with the controller link as the redirect
|
||||||
|
$url = generateControllerUrl('login');
|
||||||
|
$redirect = urlencode($_SERVER[PHP_SELF] . '?' . $_SERVER['QUERY_STRING']);
|
||||||
|
if ((strlen($redirect) > 1)) {
|
||||||
|
$url = $url . '&redirect=' . $redirect;
|
||||||
|
}
|
||||||
|
if (PEAR::isError($ret)) {
|
||||||
|
$url = $url . '&errorMessage=' . urlencode($ret->getMessage());
|
||||||
|
session_start();
|
||||||
|
$_SESSION['errormessage']['login'] = $ret->getMessage();
|
||||||
|
}
|
||||||
|
redirect($url);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// we appear to have some encoding/decoding issues, so we need to force-check for %30 type situations
|
||||||
|
$queryString = KTUtil::arrayGet($_REQUEST, 'qs', '');
|
||||||
|
if (is_array($queryString)) {
|
||||||
|
$aStrings = array();
|
||||||
|
foreach ($queryString as $k => $v) {
|
||||||
|
$aStrings[] = $k . '=' . $v;
|
||||||
|
}
|
||||||
|
$queryString = join('&', $aStrings);
|
||||||
|
} elseif (count(preg_match('#\%#', $queryString) != 0)) {
|
||||||
|
$queryString = urldecode($queryString);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($queryString)) {
|
||||||
|
// need to strip query string params from action before attempting to retrieve from sitemap
|
||||||
|
$queryString = '';
|
||||||
|
// check for the presence of additional params
|
||||||
|
if (strstr($_SERVER['QUERY_STRING'], '&')) {
|
||||||
|
// strip and save the querystring
|
||||||
|
$queryString = substr($_SERVER['QUERY_STRING'], strpos($_SERVER['QUERY_STRING'], '&')+1, strlen($_SERVER['QUERY_STRING']));
|
||||||
|
} else if (strstr($_SERVER['QUERY_STRING'], '?')) {
|
||||||
|
// strip and save the querystring
|
||||||
|
$queryString = substr($_SERVER['QUERY_STRING'], strpos($_SERVER['QUERY_STRING'], '?')+1, strlen($_SERVER['QUERY_STRING']));
|
||||||
|
// update
|
||||||
|
$action = substr($_SERVER['QUERY_STRING'], 0, strpos($_SERVER['QUERY_STRING'], '?'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == 'dashboard') {
|
||||||
|
$oKTConfig = KTConfig::getSingleton();
|
||||||
|
if(!$oKTConfig->get('useNewDashboard')) $action = 'olddashboard';
|
||||||
|
}
|
||||||
|
|
||||||
|
// retrieve the page from the sitemap (checks whether this user has access to the requested page)
|
||||||
|
$page = $default->siteMap->getPage($action, isset($_SESSION['userID']) ? $_SESSION['userID'] : '');
|
||||||
|
|
||||||
|
if (!$page) {
|
||||||
|
// this user doesn't have permission to access the page
|
||||||
|
// or there is no page mapping for the requested action
|
||||||
|
// redirect to no permission page
|
||||||
|
$default->log->error("control.php getPage failed for ($action, " . $_SESSION['userID'] . ")");
|
||||||
|
redirect("$default->uiUrl/noAccess.php");
|
||||||
|
} else {
|
||||||
|
$page = $default->rootUrl . $page;
|
||||||
|
// set authorised flag and redirect
|
||||||
|
// strip querystring from the page returned from the sitemap
|
||||||
|
// before setting page authorisation flag (since checkSession checks page level
|
||||||
|
// access by checking $_SESSION["pageAccess"][$_SERVER["PHP_SELF"] ie. without querystring(?)
|
||||||
|
|
||||||
|
$paramStart=strpos($page, '?');
|
||||||
|
if ($paramStart !== false) {
|
||||||
|
$accessPage = substr($page, 0, $paramStart);
|
||||||
|
} else {
|
||||||
|
$accessPage = $page;
|
||||||
|
}
|
||||||
|
$_SESSION['pageAccess'][$accessPage] = true;
|
||||||
|
// if we have a querystring add it on
|
||||||
|
if (strlen($queryString) > 0) {
|
||||||
|
$page .= ($paramStart !== false)?'&':'?';
|
||||||
|
$page .= $queryString;
|
||||||
|
$default->log->info("control.php: about to redirect to $page");
|
||||||
|
}
|
||||||
|
redirect($page);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
86
customerrorpage.php
Normal file
86
customerrorpage.php
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): ______________________________________
|
||||||
|
*/
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
// Get the error message
|
||||||
|
$error = isset($_POST['fatal']) ? $_POST['fatal'] : '';
|
||||||
|
$error = isset($_SESSION['sErrorMessage']) ? $_SESSION['sErrorMessage'] : $error;
|
||||||
|
unset($_SESSION['sErrorMessage']);
|
||||||
|
//Finding root Url
|
||||||
|
$sHost = $_SERVER['HTTP_HOST'];
|
||||||
|
$sScriptName = dirname($_SERVER['SCRIPT_NAME']);
|
||||||
|
$sRoot = $sHost.$sScriptName;
|
||||||
|
$sLastChar = substr($sScriptName, -1, 1);
|
||||||
|
$sScriptName = ($sLastChar == '\\' || $sLastChar == '/') ? substr($sScriptName, 0, -1) : $sScriptName;
|
||||||
|
$bSSLEnabled = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') ? true : false;
|
||||||
|
$sRootUrl = ($bSSLEnabled ? 'https://' : 'http://').$sRoot;
|
||||||
|
|
||||||
|
$error = strip_tags($error);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Knowledgetree - Desklet</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="<?php echo $sRootUrl ?>/resources/css/errors.css" />
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
function Click()
|
||||||
|
{
|
||||||
|
var open = document.getElementById('exp');
|
||||||
|
open.style.display = 'block';
|
||||||
|
var border = document.getElementById('error-container');
|
||||||
|
border.style.height = '220px';
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="error-container">
|
||||||
|
<div id="acc-error">
|
||||||
|
|
||||||
|
<h1>An Error Has Occurred</h1>
|
||||||
|
<p>You have encountered a problem with your document management system.</p>
|
||||||
|
<p>Please contact your systems administrator.</p>
|
||||||
|
<p>For more information on the error click here: <img src="<?php echo $sRootUrl ?>/resources/graphics/info.gif" style="cursor: pointer;" onclick="Click()" />
|
||||||
|
<div id ="exp" style="display: none; "> <?php echo $error; ?></div>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
183
dashboard.php
Normal file
183
dashboard.php
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Main dashboard page -- This page is presented to the user after login.
|
||||||
|
* It contains a high level overview of the users subscriptions, checked out
|
||||||
|
* document, pending approval routing documents, etc.
|
||||||
|
*
|
||||||
|
* KnowledgeTree Community Edition
|
||||||
|
* Document Management Made Simple
|
||||||
|
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
|
||||||
|
* must display the words "Powered by KnowledgeTree" and retain the original
|
||||||
|
* copyright notice.
|
||||||
|
* Contributor( s): ______________________________________
|
||||||
|
*/
|
||||||
|
|
||||||
|
// main library routines and defaults
|
||||||
|
require_once('config/dmsDefaults.php');
|
||||||
|
require_once(KT_LIB_DIR . '/unitmanagement/Unit.inc');
|
||||||
|
|
||||||
|
require_once(KT_LIB_DIR . '/dashboard/dashletregistry.inc.php');
|
||||||
|
require_once(KT_LIB_DIR . '/dashboard/dashlet.inc.php');
|
||||||
|
require_once(KT_LIB_DIR . '/templating/templating.inc.php');
|
||||||
|
require_once(KT_LIB_DIR . '/templating/kt3template.inc.php');
|
||||||
|
require_once(KT_LIB_DIR . '/dispatcher.inc.php');
|
||||||
|
|
||||||
|
require_once(KT_LIB_DIR . '/dashboard/DashletDisables.inc.php');
|
||||||
|
|
||||||
|
$sectionName = 'dashboard';
|
||||||
|
|
||||||
|
class DashboardDispatcher extends KTStandardDispatcher {
|
||||||
|
|
||||||
|
var $notifications = array();
|
||||||
|
var $sHelpPage = 'ktcore/dashboard.html';
|
||||||
|
|
||||||
|
function DashboardDispatcher() {
|
||||||
|
$this->aBreadcrumbs = array(
|
||||||
|
array('action' => 'dashboard', 'name' => _kt('Dashboard')),
|
||||||
|
);
|
||||||
|
return parent::KTStandardDispatcher();
|
||||||
|
}
|
||||||
|
function do_main() {
|
||||||
|
$this->oPage->setShowPortlets(false);
|
||||||
|
// retrieve action items for the user.
|
||||||
|
// FIXME what is the userid?
|
||||||
|
|
||||||
|
|
||||||
|
$oDashletRegistry =& KTDashletRegistry::getSingleton();
|
||||||
|
$aDashlets = $oDashletRegistry->getDashlets($this->oUser);
|
||||||
|
|
||||||
|
$this->sSection = 'dashboard';
|
||||||
|
$this->oPage->setBreadcrumbDetails(_kt('Home'));
|
||||||
|
$this->oPage->title = _kt('Dashboard');
|
||||||
|
|
||||||
|
// simplistic improvement over the standard rendering: float half left
|
||||||
|
// and half right. +Involves no JS -can leave lots of white-space at the bottom.
|
||||||
|
|
||||||
|
$aDashletsLeft = array();
|
||||||
|
$aDashletsRight = array();
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
foreach ($aDashlets as $oDashlet) {
|
||||||
|
if(strpos(strtolower($oDashlet->sTitle), 'welcome to knowledgetree') !== false && !empty($aDashletsLeft)){
|
||||||
|
array_unshift($aDashletsLeft, $oDashlet);
|
||||||
|
}else{
|
||||||
|
if ($i == 0) { $aDashletsLeft[] = $oDashlet; }
|
||||||
|
else {$aDashletsRight[] = $oDashlet; }
|
||||||
|
}
|
||||||
|
$i += 1;
|
||||||
|
$i %= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// javascript - broken input focus
|
||||||
|
// using this code causes focus problems in the Go To Document dashlet:
|
||||||
|
// while the input can be focused, it requires clicking the text to the LEFT
|
||||||
|
// of the input, which is not expected nor obvious nor user friendly
|
||||||
|
/*
|
||||||
|
$this->oPage->requireJSResource('thirdpartyjs/extjs/adapter/yui/yui-utilities.js');
|
||||||
|
$this->oPage->requireJSResource('resources/js/DDList.js');
|
||||||
|
*/
|
||||||
|
|
||||||
|
// javascript - working input focus - restoring yui fixes the focus problem
|
||||||
|
// yahoo
|
||||||
|
$this->oPage->requireJSResource('thirdpartyjs/yui/yahoo/yahoo.js');
|
||||||
|
$this->oPage->requireJSResource('thirdpartyjs/yui/event/event.js');
|
||||||
|
$this->oPage->requireJSResource('thirdpartyjs/yui/dom/dom.js');
|
||||||
|
$this->oPage->requireJSResource('thirdpartyjs/yui/dragdrop/dragdrop.js');
|
||||||
|
$this->oPage->requireJSResource('resources/js/DDList.js');
|
||||||
|
|
||||||
|
$this->oUser->refreshDashboadState();
|
||||||
|
|
||||||
|
// dashboard
|
||||||
|
$sDashboardState = $this->oUser->getDashboardState();
|
||||||
|
$sDSJS = 'var savedState = ';
|
||||||
|
if($sDashboardState == null) {
|
||||||
|
$sDSJS .= 'false';
|
||||||
|
$sDashboardState = false;
|
||||||
|
} else {
|
||||||
|
$sDSJS .= $sDashboardState;
|
||||||
|
}
|
||||||
|
$sDSJS .= ';';
|
||||||
|
$this->oPage->requireJSStandalone($sDSJS);
|
||||||
|
$this->oPage->requireJSResource('resources/js/dashboard.js');
|
||||||
|
|
||||||
|
// render
|
||||||
|
$oTemplating =& KTTemplating::getSingleton();
|
||||||
|
$oTemplate = $oTemplating->loadTemplate('kt3/dashboard');
|
||||||
|
$aTemplateData = array(
|
||||||
|
'context' => $this,
|
||||||
|
'dashlets_left' => $aDashletsLeft,
|
||||||
|
'dashlets_right' => $aDashletsRight,
|
||||||
|
);
|
||||||
|
return $oTemplate->render($aTemplateData);
|
||||||
|
}
|
||||||
|
|
||||||
|
// return some kind of ID for each dashlet
|
||||||
|
// currently uses the class name
|
||||||
|
function _getDashletId($oDashlet) {
|
||||||
|
return get_class($oDashlet);
|
||||||
|
}
|
||||||
|
|
||||||
|
// disable a dashlet.
|
||||||
|
// FIXME this very slightly violates the separation of concerns, but its not that flagrant.
|
||||||
|
function do_disableDashlet() {
|
||||||
|
$sNamespace = KTUtil::arrayGet($_REQUEST, 'fNamespace');
|
||||||
|
$iUserId = $this->oUser->getId();
|
||||||
|
|
||||||
|
if (empty($sNamespace)) {
|
||||||
|
$this->errorRedirectToMain('No dashlet specified.');
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// do the "delete"
|
||||||
|
|
||||||
|
$this->startTransaction();
|
||||||
|
$aParams = array('sNamespace' => $sNamespace, 'iUserId' => $iUserId);
|
||||||
|
$oDD = KTDashletDisable::createFromArray($aParams);
|
||||||
|
if (PEAR::isError($oDD)) {
|
||||||
|
$this->errorRedirectToMain('Failed to disable the dashlet.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->commitTransaction();
|
||||||
|
$this->successRedirectToMain('Dashlet disabled.');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function json_saveDashboardState() {
|
||||||
|
$sState = KTUtil::arrayGet($_REQUEST, 'state', array('error'=>true));
|
||||||
|
$this->oUser->setDashboardState($sState);
|
||||||
|
return array('success' => true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$oDispatcher = new DashboardDispatcher();
|
||||||
|
$oDispatcher->dispatch();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
5
default.htm
Normal file
5
default.htm
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="refresh" content="0; url=control.php"/>
|
||||||
|
</head>
|
||||||
|
</html>
|
||||||
105
dmsctl.bat
Normal file
105
dmsctl.bat
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
rem KnowledgeTree Control Script
|
||||||
|
|
||||||
|
rem ============= SET ENVIRONMENT VARIABLES ==============
|
||||||
|
set INSTALL_PATH=%~dp0
|
||||||
|
cd ..
|
||||||
|
cd ..
|
||||||
|
set ZEND_PATH=%CD%
|
||||||
|
cd %INSTALL_PATH%
|
||||||
|
cd ..
|
||||||
|
set KTDMS_PATH=%CD%
|
||||||
|
cd %INSTALL_PATH%
|
||||||
|
set JAVA_BIN=%KTDMS_PATH%\jre\bin\java.exe
|
||||||
|
set SOFFICE_PATH=%KTDMS_PATH%\openoffice
|
||||||
|
set SOFFICE_BIN=%SOFFICE_PATH%\program\soffice.exe
|
||||||
|
set SOFFICE_PORT=8100
|
||||||
|
|
||||||
|
set OpenofficeServiceName=KTOpenoffice
|
||||||
|
set SchedulerServiceName=KTScheduler
|
||||||
|
set LuceneServiceName=KTLucene
|
||||||
|
set MySQLServiceName=MySQL_ZendServer51
|
||||||
|
|
||||||
|
rem ============= MAIN ==============
|
||||||
|
IF NOT ""%1"" == ""start"" IF NOT ""%1"" == ""path"" IF NOT ""%1"" == ""stop"" IF NOT ""%1"" == ""restart"" IF NOT ""%1"" == ""install"" IF NOT ""%1"" == ""uninstall"" goto help
|
||||||
|
goto %1
|
||||||
|
|
||||||
|
:help
|
||||||
|
echo USAGE:
|
||||||
|
echo.
|
||||||
|
echo dmsctl.bat ^<start^|stop^|restart^|install^|uninstall^> [servicename]
|
||||||
|
echo.
|
||||||
|
echo help - this screen
|
||||||
|
echo.
|
||||||
|
echo start - start the services
|
||||||
|
echo stop - stop the services
|
||||||
|
echo restart - restart the services
|
||||||
|
echo.
|
||||||
|
echo install - install the services
|
||||||
|
echo uninstall - uninstall the services
|
||||||
|
echo.
|
||||||
|
echo servicename - optional service name to start/stop only that service.
|
||||||
|
echo only mysql is supported for individual control at this time.
|
||||||
|
echo.
|
||||||
|
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:start
|
||||||
|
IF ""%2"" == ""mysql"" goto start_mysql
|
||||||
|
echo Starting services
|
||||||
|
sc start %OpenofficeServiceName%
|
||||||
|
sc start %LuceneServiceName%
|
||||||
|
ping -n 7 127.0.0.1 > null
|
||||||
|
sc start %SchedulerServiceName%
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:stop
|
||||||
|
IF ""%2"" == ""mysql"" goto stop_mysql
|
||||||
|
echo Stopping services
|
||||||
|
sc stop %LuceneServiceName%
|
||||||
|
sc stop %SchedulerServiceName%
|
||||||
|
sc stop %OpenofficeServiceName%
|
||||||
|
ping -n 7 127.0.0.1 > null
|
||||||
|
IF ""%1"" == ""restart"" goto start
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:start_mysql
|
||||||
|
echo Starting MySQL Service
|
||||||
|
sc start %MySQLServiceName%
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:stop_mysql
|
||||||
|
echo Stopping MySQL Service
|
||||||
|
sc stop %MySQLServiceName%
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:restart
|
||||||
|
goto stop
|
||||||
|
|
||||||
|
:uninstall
|
||||||
|
echo Uninstalling services
|
||||||
|
sc delete %LuceneServiceName%
|
||||||
|
sc delete %SchedulerServiceName%
|
||||||
|
sc delete %OpenofficeServiceName%
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:path
|
||||||
|
echo ZEND_PATH == %ZEND_PATH%
|
||||||
|
echo KTDMS_PATH == %KTDMS_PATH%
|
||||||
|
echo INSTALL_PATH == %INSTALL_PATH%
|
||||||
|
echo JAVA_BIN == %JAVA_BIN%
|
||||||
|
echo SOFFICE_PATH == %SOFFICE_PATH%
|
||||||
|
echo SOFFICE_BIN == %SOFFICE_BIN%
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:install
|
||||||
|
echo Installing services
|
||||||
|
IF EXIST "%INSTALL_PATH%\var\bin\officeinstall.bat" call "%INSTALL_PATH%\var\bin\officeinstall.bat"
|
||||||
|
IF EXIST "%INSTALL_PATH%\var\bin\officeinstall.bat" echo The Open Office automatic service was successfully installed.
|
||||||
|
IF EXIST "%INSTALL_PATH%\var\bin\schedulerinstall.bat" call "%INSTALL_PATH%\var\bin\schedulerinstall.bat"
|
||||||
|
IF EXIST "%INSTALL_PATH%\var\bin\schedulerinstall.bat" echo The Scheduler automatic service was successfully installed.
|
||||||
|
IF EXIST "%INSTALL_PATH%\var\bin\luceneinstall.bat" call "%INSTALL_PATH%\var\bin\luceneinstall.bat"
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:end
|
||||||
486
dmsctl.sh
Normal file
486
dmsctl.sh
Normal file
@ -0,0 +1,486 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Boot KnowledgeTree services
|
||||||
|
# chkconfig: 2345 55 25
|
||||||
|
# description: KnowledgeTree Services
|
||||||
|
#
|
||||||
|
# processname: ktdms
|
||||||
|
|
||||||
|
cd $(dirname $0)
|
||||||
|
|
||||||
|
HOSTNAME=`hostname`
|
||||||
|
RETVAL=0
|
||||||
|
PID=""
|
||||||
|
ERROR=0
|
||||||
|
SERVER=all
|
||||||
|
VDISPLAY="99"
|
||||||
|
INSTALL_PATH=`pwd`
|
||||||
|
JAVABIN=/usr/bin/java
|
||||||
|
ZEND_DIR=/usr/local/zend
|
||||||
|
|
||||||
|
# exits if the UID is not 0 [root]
|
||||||
|
check_root_privileges()
|
||||||
|
{
|
||||||
|
ID="id -u"
|
||||||
|
MYUID=`$ID 2> /dev/null`
|
||||||
|
if [ ! -z "$MYUID" ]; then
|
||||||
|
if [ $MYUID != 0 ]; then
|
||||||
|
echo "You need root privileges to run this script!";
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Could not detect UID";
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if [ -f /etc/zce.rc ];then
|
||||||
|
. /etc/zce.rc
|
||||||
|
else
|
||||||
|
echo "/etc/zce.rc doesn't exist!"
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
check_root_privileges
|
||||||
|
|
||||||
|
# OpenOffice
|
||||||
|
SOFFICEFILE=soffice
|
||||||
|
SOFFICE_PIDFILE=$INSTALL_PATH/var/log/soffice.bin.pid
|
||||||
|
SOFFICE_PID=""
|
||||||
|
SOFFICE_PORT="8100"
|
||||||
|
SOFFICEBIN=/usr/share/ktdms-office/ktdms-office/openoffice/program/soffice
|
||||||
|
SOFFICE="$SOFFICEBIN -nofirststartwizard -nologo -headless -accept=socket,host=127.0.0.1,port=$SOFFICE_PORT;urp;StarOffice.ServiceManager"
|
||||||
|
SOFFICE_STATUS=""
|
||||||
|
|
||||||
|
# Lucene
|
||||||
|
LUCENE_PIDFILE=$INSTALL_PATH/var/log/lucene.pid
|
||||||
|
LUCENE_PID=""
|
||||||
|
LUCENE="$JAVABIN -Xms512M -Xmx512M -jar ktlucene.jar"
|
||||||
|
LUCENE_STATUS=""
|
||||||
|
|
||||||
|
# Scheduler
|
||||||
|
SCHEDULER_PATH="$INSTALL_PATH/bin/"
|
||||||
|
SCHEDULER_PIDFILE=$INSTALL_PATH/var/log/scheduler.pid
|
||||||
|
SCHEDULER_PID=""
|
||||||
|
SCHEDULERBIN="$INSTALL_PATH/var/bin/schedulerTask.sh"
|
||||||
|
SCHEDULER="$SCHEDULERBIN"
|
||||||
|
SCHEDULER_STATUS=""
|
||||||
|
|
||||||
|
# MySQL: modify if needed for your installation
|
||||||
|
MYSQL_PATH=/etc/init.d
|
||||||
|
MYSQLBIN=mysql
|
||||||
|
MYSQL_PIDFILE=/var/run/mysqld/mysqld.pid
|
||||||
|
MYSQL_PID=""
|
||||||
|
MYSQL_STATUS=""
|
||||||
|
|
||||||
|
get_pid() {
|
||||||
|
PID=""
|
||||||
|
PIDFILE=$1
|
||||||
|
# check for pidfile
|
||||||
|
if [ -f $PIDFILE ] ; then
|
||||||
|
exec 6<&0
|
||||||
|
exec < $PIDFILE
|
||||||
|
read pid
|
||||||
|
PID=$pid
|
||||||
|
exec 0<&6 6<&-
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
get_soffice_pid() {
|
||||||
|
get_pid $SOFFICE_PIDFILE
|
||||||
|
if [ ! $PID ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if [ $PID -gt 0 ]; then
|
||||||
|
SOFFICE_PID=$PID
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
get_lucene_pid() {
|
||||||
|
get_pid $LUCENE_PIDFILE
|
||||||
|
if [ ! $PID ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if [ $PID -gt 0 ]; then
|
||||||
|
LUCENE_PID=$PID
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
get_scheduler_pid() {
|
||||||
|
get_pid $SCHEDULER_PIDFILE
|
||||||
|
if [ ! $PID ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if [ $PID -gt 0 ]; then
|
||||||
|
SCHEDULER_PID=$PID
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
get_mysql_pid() {
|
||||||
|
get_pid $MYSQL_PIDFILE
|
||||||
|
if [ ! $PID ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if [ $PID -gt 0 ]; then
|
||||||
|
MYSQL_PID=$PID
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
is_service_running() {
|
||||||
|
PID=$1
|
||||||
|
if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then
|
||||||
|
RUNNING=1
|
||||||
|
else
|
||||||
|
RUNNING=0
|
||||||
|
fi
|
||||||
|
return $RUNNING
|
||||||
|
}
|
||||||
|
|
||||||
|
is_soffice_running() {
|
||||||
|
get_soffice_pid
|
||||||
|
is_service_running $SOFFICE_PID
|
||||||
|
RUNNING=$?
|
||||||
|
if [ $RUNNING -eq 0 ]; then
|
||||||
|
SOFFICE_STATUS="openoffice not running"
|
||||||
|
else
|
||||||
|
SOFFICE_STATUS="openoffice already running"
|
||||||
|
fi
|
||||||
|
return $RUNNING
|
||||||
|
}
|
||||||
|
|
||||||
|
is_lucene_running() {
|
||||||
|
get_lucene_pid
|
||||||
|
is_service_running $LUCENE_PID
|
||||||
|
RUNNING=$?
|
||||||
|
if [ $RUNNING -eq 0 ]; then
|
||||||
|
LUCENE_STATUS="lucene not running"
|
||||||
|
else
|
||||||
|
LUCENE_STATUS="lucene already running"
|
||||||
|
fi
|
||||||
|
return $RUNNING
|
||||||
|
}
|
||||||
|
|
||||||
|
is_scheduler_running() {
|
||||||
|
get_scheduler_pid
|
||||||
|
is_service_running $SCHEDULER_PID
|
||||||
|
RUNNING=$?
|
||||||
|
if [ $RUNNING -eq 0 ]; then
|
||||||
|
SCHEDULER_STATUS="scheduler not running"
|
||||||
|
else
|
||||||
|
SCHEDULER_STATUS="scheduler already running"
|
||||||
|
fi
|
||||||
|
return $RUNNING
|
||||||
|
}
|
||||||
|
|
||||||
|
is_mysql_running() {
|
||||||
|
get_mysql_pid
|
||||||
|
is_service_running $MYSQL_PID
|
||||||
|
RUNNING=$?
|
||||||
|
if [ $RUNNING -eq 0 ]; then
|
||||||
|
MYSQL_STATUS="mysql not running"
|
||||||
|
else
|
||||||
|
MYSQL_STATUS="mysql already running"
|
||||||
|
fi
|
||||||
|
return $RUNNING
|
||||||
|
}
|
||||||
|
|
||||||
|
start_soffice() {
|
||||||
|
is_soffice_running
|
||||||
|
RUNNING=$?
|
||||||
|
|
||||||
|
if [ $RUNNING -eq 1 ]; then
|
||||||
|
echo "$0 $ARG: openoffice (pid $SOFFICE_PID) already running"
|
||||||
|
else
|
||||||
|
if [ -x $SOFFICEBIN ]; then
|
||||||
|
nohup $SOFFICE &> $INSTALL_PATH/var/log/dmsctl.log &
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "$0 $ARG: openoffice started at port $SOFFICE_PORT"
|
||||||
|
ps ax | grep $SOFFICEBIN | awk {'print $1'} > $SOFFICE_PIDFILE
|
||||||
|
sleep 2
|
||||||
|
else
|
||||||
|
echo "$0 $ARG: openoffice could not be started"
|
||||||
|
ERROR=3
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "$0 $ARG: path to openoffice binary ($SOFFICEBIN) could not be found"
|
||||||
|
ERROR=3
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_soffice() {
|
||||||
|
NO_EXIT_ON_ERROR=$1
|
||||||
|
is_soffice_running
|
||||||
|
RUNNING=$?
|
||||||
|
|
||||||
|
if [ $RUNNING -eq 0 ]; then
|
||||||
|
echo "$0 $ARG: $SOFFICE_STATUS"
|
||||||
|
if [ "x$NO_EXIT_ON_ERROR" != "xno_exit" ]; then
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
get_soffice_pid
|
||||||
|
if killall $SOFFICEFILE; then
|
||||||
|
echo "$0 $ARG: openoffice stopped"
|
||||||
|
else
|
||||||
|
echo "$0 $ARG: openoffice could not be stopped"
|
||||||
|
ERROR=4
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
start_lucene() {
|
||||||
|
is_lucene_running
|
||||||
|
RUNNING=$?
|
||||||
|
|
||||||
|
if [ $RUNNING -eq 1 ]; then
|
||||||
|
echo "$0 $ARG: lucene (pid $LUCENE_PID) already running"
|
||||||
|
else
|
||||||
|
cd $INSTALL_PATH/bin/luceneserver
|
||||||
|
nohup $LUCENE &> $INSTALL_PATH/var/log/dmsctl.log &
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "$0 $ARG: lucene started"
|
||||||
|
ps ax | grep ktlucene.jar | awk {'print $1'} > $LUCENE_PIDFILE
|
||||||
|
sleep 2
|
||||||
|
else
|
||||||
|
echo "$0 $ARG: lucene could not be started"
|
||||||
|
ERROR=3
|
||||||
|
fi
|
||||||
|
cd $INSTALL_PATH
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_lucene() {
|
||||||
|
NO_EXIT_ON_ERROR=$1
|
||||||
|
is_lucene_running
|
||||||
|
RUNNING=$?
|
||||||
|
|
||||||
|
if [ $RUNNING -eq 0 ]; then
|
||||||
|
echo "$0 $ARG: $LUCENE_STATUS"
|
||||||
|
if [ "x$NO_EXIT_ON_ERROR" != "xno_exit" ]; then
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
get_lucene_pid
|
||||||
|
cd $INSTALL_PATH/search2/indexing/bin
|
||||||
|
$ZEND_DIR/bin/php shutdown.php positive &> $INSTALL_PATH/var/log/dmsctl.log
|
||||||
|
exit=$?
|
||||||
|
sleep 5
|
||||||
|
if [ $exit -eq 0 ]; then
|
||||||
|
echo "$0 $ARG: lucene stopped"
|
||||||
|
else
|
||||||
|
echo "$0 $ARG: lucene could not be stopped"
|
||||||
|
ERROR=4
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
start_scheduler() {
|
||||||
|
is_scheduler_running
|
||||||
|
RUNNING=$?
|
||||||
|
|
||||||
|
if [ $RUNNING -eq 1 ]; then
|
||||||
|
echo "$0 $ARG: scheduler (pid $SCHEDULER_PID) already running"
|
||||||
|
else
|
||||||
|
cd $SCHEDULER_PATH
|
||||||
|
nohup $SCHEDULER &> $INSTALL_PATH/var/log/dmsctl.log &
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "$0 $ARG: scheduler started"
|
||||||
|
ps ax | grep $SCHEDULERBIN | awk {'print $1'} > $SCHEDULER_PIDFILE
|
||||||
|
sleep 2
|
||||||
|
else
|
||||||
|
echo "$0 $ARG: scheduler could not be started"
|
||||||
|
ERROR=3
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_scheduler() {
|
||||||
|
NO_EXIT_ON_ERROR=$1
|
||||||
|
is_scheduler_running
|
||||||
|
RUNNING=$?
|
||||||
|
|
||||||
|
if [ $RUNNING -eq 0 ]; then
|
||||||
|
echo "$0 $ARG: $SCHEDULER_STATUS"
|
||||||
|
if [ "x$NO_EXIT_ON_ERROR" != "xno_exit" ]; then
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
get_scheduler_pid
|
||||||
|
if kill $SCHEDULER_PID ; then
|
||||||
|
echo "$0 $ARG: scheduler stopped"
|
||||||
|
else
|
||||||
|
echo "$0 $ARG: scheduler could not be stopped"
|
||||||
|
ERROR=4
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
start_mysql() {
|
||||||
|
is_mysql_running
|
||||||
|
RUNNING=$?
|
||||||
|
|
||||||
|
if [ $RUNNING -eq 1 ]; then
|
||||||
|
echo "$0 $ARG: mysql (pid $MYSQL_PID) already running"
|
||||||
|
else
|
||||||
|
nohup $MYSQL_PATH/$MYSQLBIN start &> $INSTALL_PATH/var/log/dmsctl.log &
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "$0 $ARG: mysql started"
|
||||||
|
ps ax | grep $MYSQLBIN | awk {'print $1'} > $MYSQL_PIDFILE
|
||||||
|
sleep 2
|
||||||
|
else
|
||||||
|
echo "$0 $ARG: mysql could not be started"
|
||||||
|
ERROR=3
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_mysql() {
|
||||||
|
NO_EXIT_ON_ERROR=$1
|
||||||
|
is_mysql_running
|
||||||
|
RUNNING=$?
|
||||||
|
|
||||||
|
if [ $RUNNING -eq 0 ]; then
|
||||||
|
echo "$0 $ARG: $MYSQL_STATUS"
|
||||||
|
if [ "x$NO_EXIT_ON_ERROR" != "xno_exit" ]; then
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
get_mysql_pid
|
||||||
|
if kill $MYSQL_PID ; then
|
||||||
|
echo "$0 $ARG: mysql stopped"
|
||||||
|
else
|
||||||
|
echo "$0 $ARG: mysql could not be stopped"
|
||||||
|
ERROR=4
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
help() {
|
||||||
|
echo "usage: $0 help"
|
||||||
|
echo " $0 (start|stop|restart)"
|
||||||
|
echo " $0 (start|stop|restart) scheduler"
|
||||||
|
echo " $0 (start|stop|restart) soffice"
|
||||||
|
echo " $0 (start|stop|restart) lucene"
|
||||||
|
echo " $0 (start|stop|restart) mysql"
|
||||||
|
cat <<EOF
|
||||||
|
|
||||||
|
help - this screen
|
||||||
|
start - start the service(s)
|
||||||
|
stop - stop the service(s)
|
||||||
|
restart - restart or start the service(s)
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
noserver() {
|
||||||
|
echo -e "ERROR: $1 is not a valid server. Please, select 'scheduler', 'soffice' or 'lucene'\n"
|
||||||
|
help
|
||||||
|
}
|
||||||
|
|
||||||
|
firstrun() {
|
||||||
|
echo "We running for the first time, FIX ZEND"
|
||||||
|
if grep --quiet LD_LIBRARAY_PATH /etc/zce.rc ; then
|
||||||
|
echo "Nothing to be done ... maybe"
|
||||||
|
else
|
||||||
|
echo "PATH=/usr/local/zend/bin:$PATH" >> /etc/zce.rc
|
||||||
|
if [ -z $LD_LIBRARY_PATH ] ; then
|
||||||
|
echo "LD_LIBRARY_PATH=$ZEND_DIR/lib" >> /etc/zce.rc
|
||||||
|
else
|
||||||
|
echo "LD_LIBRARY_PATH=$ZEND_DIR/lib:$LD_LIBRARY_PATH" >> /etc/zce.rc
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
touch $INSTALL_PATH/var/bin/dmsinit.lock
|
||||||
|
|
||||||
|
$ZEND_DIR/bin/zendctl.sh restart
|
||||||
|
}
|
||||||
|
|
||||||
|
[ $# -lt 1 ] && help
|
||||||
|
|
||||||
|
if [ ! -z ${2} ]; then
|
||||||
|
[ "${2}" != "mysql" ] && [ "${2}" != "apache" ] && [ "${2}" != "agent" ] && [ "${2}" != "scheduler" ] && [ "${2}" != "soffice" ] && [ "${2}" != "lucene" ] && noserver $2
|
||||||
|
SERVER=$2
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ "x$3" != "x" ]; then
|
||||||
|
MYSQL_PASSWORD=$3
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Are we running for first time
|
||||||
|
if [ -e "/usr/share/knowledgetree/var/bin/dmsinit.lock" ]
|
||||||
|
then
|
||||||
|
echo "";
|
||||||
|
else
|
||||||
|
if grep --quiet LD_LIBRARAY_PATH /etc/zce.rc ; then
|
||||||
|
echo "Nothing to be done ... maybe"
|
||||||
|
else
|
||||||
|
echo "PATH=/usr/local/zend/bin:$PATH" >> /etc/zce.rc
|
||||||
|
if [ -z $LD_LIBRARY_PATH ] ; then
|
||||||
|
echo "LD_LIBRARY_PATH=$ZEND_DIR/lib" >> /etc/zce.rc
|
||||||
|
else
|
||||||
|
echo "LD_LIBRARY_PATH=$ZEND_DIR/lib:$LD_LIBRARY_PATH" >> /etc/zce.rc
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
touch $INSTALL_PATH/var/bin/dmsinit.lock
|
||||||
|
$ZEND_DIR/bin/zendctl.sh restart
|
||||||
|
fi
|
||||||
|
|
||||||
|
#if [ "ls /usr/share/knowledgetree/var/bin/dmsinit.lock" != "" ] ; then
|
||||||
|
# echo "No lock"
|
||||||
|
#e#lse
|
||||||
|
# echo "lock"
|
||||||
|
#f#i
|
||||||
|
|
||||||
|
#if [ -f "/usr/share/knowledgetree/var/bin/dmsinit.lock"] ; then
|
||||||
|
# firstrun
|
||||||
|
#else
|
||||||
|
# echo 'safd';
|
||||||
|
# exit 1;
|
||||||
|
#fi
|
||||||
|
|
||||||
|
#[[ -e $INSTALL_PATH/var/bin/dmsinit.lock ]] || firstrun
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
help) help
|
||||||
|
;;
|
||||||
|
start)
|
||||||
|
if [ "${SERVER}" != "all" ]; then
|
||||||
|
start_${2}
|
||||||
|
else
|
||||||
|
start_soffice
|
||||||
|
start_lucene
|
||||||
|
start_scheduler
|
||||||
|
#[[ -e $ZEND_DIR/bin/zendctl.sh ]] && $ZEND_DIR/bin/zendctl.sh restart
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
stop) if [ "${SERVER}" != "all" ]; then
|
||||||
|
stop_${2}
|
||||||
|
else
|
||||||
|
stop_scheduler "no_exit"
|
||||||
|
stop_lucene "no_exit"
|
||||||
|
stop_soffice "no_exit"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
restart) if [ "${SERVER}" != "all" ]; then
|
||||||
|
stop_${2} "no_exit"
|
||||||
|
sleep 2
|
||||||
|
start_${2}
|
||||||
|
else
|
||||||
|
stop_scheduler "no_exit"
|
||||||
|
stop_lucene "no_exit"
|
||||||
|
stop_soffice "no_exit"
|
||||||
|
start_soffice
|
||||||
|
start_lucene
|
||||||
|
start_scheduler
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit $ERROR
|
||||||
739
dmsctl.vbs
Normal file
739
dmsctl.vbs
Normal file
@ -0,0 +1,739 @@
|
|||||||
|
'
|
||||||
|
' KnowledgeTree
|
||||||
|
'
|
||||||
|
'
|
||||||
|
'
|
||||||
|
|
||||||
|
' Service Name Consts
|
||||||
|
Const KTOFFICE = "KTOpenoffice"
|
||||||
|
Const KTSCHEDULER = "KTScheduler"
|
||||||
|
Const KTLUCENE = "KTLucene"
|
||||||
|
|
||||||
|
' Service Control Manager Error Code Consts
|
||||||
|
Const SVC_SUCCESS = 0 ' Success
|
||||||
|
Const SVC_NOT_SUPPORTED = 1 ' Not Supported
|
||||||
|
Const SVC_ACCESS_DENIED = 2 ' Access Denied
|
||||||
|
Const SVC_DEPENDENT_SERVICES_RUNNING = 3 ' Dependent Services Running
|
||||||
|
Const SVC_INVALID_SERVICE_CONTROL = 4 ' Invalid Service Control
|
||||||
|
Const SVC_SERVICE_CANNOT_ACCEPT_CONTROL = 5 ' Service Cannot Accept Control
|
||||||
|
Const SVC_SERVICE_NOT_ACTIVE = 6 ' Service Not Active
|
||||||
|
Const SVC_SERVICE_REQUEST_TIMEOUT = 7 ' Service Request Timeout
|
||||||
|
Const SVC_UNKNOWN_FAILURE = 8 ' Unknown Failure
|
||||||
|
Const SVC_PATH_NOT_FOUND = 9 ' Path Not Found
|
||||||
|
Const SVC_SERVICE_ALREADY_RUNNING = 10 ' Service Already Running
|
||||||
|
Const SVC_SERVICE_DATABASE_LOCKED = 11 ' Service Database Locked
|
||||||
|
Const SVC_SERVICE_DEPENDENCY_DELETED = 12 ' Service Dependency Deleted
|
||||||
|
Const SVC_SERVICE_DEPENDENCY_FAILURE = 13 ' Service Dependency Failure
|
||||||
|
Const SVC_SERVICE_DISABLED = 14 ' Service Disabled
|
||||||
|
Const SVC_SERVICE_LOGON_FAILURE = 15 ' Service Logon Failure
|
||||||
|
Const SVC_SERVICE_MARKED_FOR_DELETION = 16 ' Service Marked For Deletion
|
||||||
|
Const SVC_SERVICES_NO_THREAD = 17 ' Service No Thread
|
||||||
|
Const SVC_STATUS_CIRCULAR_DEPENDENCY = 18 ' Status Circular Dependency
|
||||||
|
Const SVC_STATUS_DUPLICATE_NAME = 19 ' Status Duplicate Name
|
||||||
|
Const SVC_INVALID_NAME = 20 ' Status Invalid Name
|
||||||
|
Const SVC_STATUS_INVALID_PARAMETER = 21 ' Status Invalid Parameter
|
||||||
|
Const SVC_INVALID_SERVICES_ACCOUNT = 22 ' Status Invalid Service Account
|
||||||
|
Const SVC_STATUS_SERVICE_EXISTS = 23 ' Status Service Exists
|
||||||
|
Const SVC_SERVICE_ALREADY_PAUSED = 24 ' Service Already Paused
|
||||||
|
|
||||||
|
Dim strComputer, currOS, currDir, doRunAs, lastErrorCode
|
||||||
|
|
||||||
|
' Detecting the current directory
|
||||||
|
Set oFso = CreateObject("Scripting.FileSystemObject")
|
||||||
|
currDir = oFso.GetParentFolderName(Wscript.ScriptFullName)
|
||||||
|
|
||||||
|
strComputer = "."
|
||||||
|
currOS = ""
|
||||||
|
doRunAs = false
|
||||||
|
|
||||||
|
' Detecting the current OS
|
||||||
|
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
|
||||||
|
Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
|
||||||
|
|
||||||
|
For Each objOperatingSystem in colOperatingSystems
|
||||||
|
currOS = objOperatingSystem.Caption & " " & objOperatingSystem.Version
|
||||||
|
currOS = trim(currOS)
|
||||||
|
Next
|
||||||
|
|
||||||
|
Public Function isWindowsVista()
|
||||||
|
isWindowsVista = false
|
||||||
|
If left(currOS, 19) = "Microsoft Windows Vista" Then
|
||||||
|
isWindowsVista = TRUE
|
||||||
|
End If
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Function isWindows7()
|
||||||
|
isWindows7 = false
|
||||||
|
If left(currOS, 19) = "Microsoft Windows 7" Then
|
||||||
|
isWindows7 = TRUE
|
||||||
|
End If
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Function isWindows2008()
|
||||||
|
isWindows2008 = false
|
||||||
|
If mid(currOS, 27, 42) = "2008 Enterprise" Then
|
||||||
|
isWindows2008 = TRUE
|
||||||
|
End If
|
||||||
|
End Function
|
||||||
|
|
||||||
|
' Will call this further down when the individual services need starting
|
||||||
|
If doRunAs = TRUE Then
|
||||||
|
'runAs "C:\Program Files (x86)\Zend\ktdms\knowledgetree", "dmsctl_install.bat"
|
||||||
|
End If
|
||||||
|
|
||||||
|
Public Sub runAs(ByVal strFolder, ByVal strFile)
|
||||||
|
Set objShell = CreateObject("Shell.Application")
|
||||||
|
Set objFolder = objShell.Namespace(strFolder)
|
||||||
|
Set objFolderItem = objFolder.ParseName(strFile)
|
||||||
|
objFolderItem.InvokeVerb "runas"
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
dim objArgs, errMsg, result, strUsage, isSuccess
|
||||||
|
|
||||||
|
strUsage = "USAGE:" &_
|
||||||
|
"dmsctl.vbs <start|stop|restart|install|uninstall> [servicename]" & vbNewLine &_
|
||||||
|
vbNewLine &_
|
||||||
|
"help - this screen " & vbNewLine &_
|
||||||
|
"start - start the services" & vbNewLine &_
|
||||||
|
"stop - stop the services" & vbNewLine &_
|
||||||
|
"restart - restart the services" & vbNewLine &_
|
||||||
|
"install - install the services" & vbNewLine &_
|
||||||
|
"uninstall - uninstall the services" & vbNewLine &_
|
||||||
|
vbNewLine &_
|
||||||
|
"servicename - optional service name to start/stop only that service." & vbNewLine &_
|
||||||
|
" only mysql is supported for individual control at this time."
|
||||||
|
|
||||||
|
Set objArgs = WScript.Arguments
|
||||||
|
If (objArgs.count < 1) Then
|
||||||
|
Wscript.Echo strUsage
|
||||||
|
Else
|
||||||
|
Select Case objArgs.Item(0)
|
||||||
|
Case "install"
|
||||||
|
isSuccess = TRUE ' Track if anything went wrong
|
||||||
|
|
||||||
|
' Installing KTOffice
|
||||||
|
result = exec(currDir & "\var\bin\officeinstall.bat")
|
||||||
|
|
||||||
|
'Install Failed
|
||||||
|
If result = 0 Then
|
||||||
|
isSuccess = false
|
||||||
|
writeLog "The " & KTOFFICE & " KnowledgeTree service could not be installed."
|
||||||
|
Else
|
||||||
|
writeLog "The " & KTOFFICE & " KnowledgeTree service was successfully installed."
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Installing KTScheduler
|
||||||
|
result = exec(currDir & "\var\bin\schedulerinstall.bat")
|
||||||
|
|
||||||
|
'Install Failed
|
||||||
|
If result = 0 Then
|
||||||
|
isSuccess = false
|
||||||
|
writeLog "The " & KTSCHEDULER & " KnowledgeTree service could not be installed."
|
||||||
|
Else
|
||||||
|
writeLog "The " & KTSCHEDULER & " KnowledgeTree service was successfully installed."
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Installing KTLucene
|
||||||
|
result = exec(currDir & "\var\bin\luceneinstall.bat")
|
||||||
|
|
||||||
|
'Install Failed
|
||||||
|
If result = 0 Then
|
||||||
|
isSuccess = false
|
||||||
|
writeLog "The " & KTLUCENE & " KnowledgeTree service could not be installed."
|
||||||
|
Else
|
||||||
|
writeLog "The " & KTLUCENE & " KnowledgeTree service was successfully installed."
|
||||||
|
End If
|
||||||
|
|
||||||
|
If (isSuccess) Then
|
||||||
|
Wscript.Echo "The KnowledgeTree services were successfully installed"
|
||||||
|
Else
|
||||||
|
Wscript.Echo "There were errors installing the KnowledgeTree services please see the log for details ('knowledgetree/var/log/dmsctl.log')"
|
||||||
|
End If
|
||||||
|
|
||||||
|
Case "start"
|
||||||
|
If (objArgs.count > 1) Then
|
||||||
|
Select Case objArgs.Item(1)
|
||||||
|
Case "soffice"
|
||||||
|
isSuccess = TRUE
|
||||||
|
svcName = KTOFFICE
|
||||||
|
If (NOT isServiceStarted(svcName)) Then
|
||||||
|
If (NOT startService(svcName)) Then
|
||||||
|
isSuccess = FALSE
|
||||||
|
writeLog "The " & KTOFFICE & " KnowledgeTree service could not be started. Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
Else
|
||||||
|
writeLog "The " & KTOFFICE & " KnowledgeTree service was successfully started"
|
||||||
|
End If
|
||||||
|
|
||||||
|
writeLog "Successfully started " & KTOFFICE
|
||||||
|
Else
|
||||||
|
writeLog KTOFFICE & " already started. Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
End If
|
||||||
|
|
||||||
|
If (isSuccess) Then
|
||||||
|
Wscript.Echo "The " & KTOFFICE & " KnowledgeTree service was successfully started"
|
||||||
|
Else
|
||||||
|
Wscript.Echo "The " & KTOFFICE & " KnowledgeTree service could not be started. Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
End If
|
||||||
|
|
||||||
|
Case "scheduler"
|
||||||
|
isSuccess = TRUE
|
||||||
|
svcName = KTSCHEDULER
|
||||||
|
If (NOT isServiceStarted(svcName)) Then
|
||||||
|
If (NOT startService(svcName)) Then
|
||||||
|
isSuccess = FALSE
|
||||||
|
writeLog "The " & KTSCHEDULER & " KnowledgeTree service could not be started. Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
Else
|
||||||
|
writeLog "The " & KTSCHEDULER & " KnowledgeTree service was successfully started"
|
||||||
|
End If
|
||||||
|
|
||||||
|
writeLog "Successfully started " & KTSCHEDULER
|
||||||
|
Else
|
||||||
|
writeLog KTSCHEDULER & " already started. Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
End If
|
||||||
|
|
||||||
|
If (isSuccess) Then
|
||||||
|
Wscript.Echo "The " & KTSCHEDULER & " KnowledgeTree service was successfully started"
|
||||||
|
Else
|
||||||
|
Wscript.Echo "The " & KTSCHEDULER & " KnowledgeTree service could not be started. Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
End If
|
||||||
|
|
||||||
|
Case "lucene"
|
||||||
|
isSuccess = TRUE
|
||||||
|
svcName = KTLUCENE
|
||||||
|
If (NOT isServiceStarted(svcName)) Then
|
||||||
|
If (NOT startService(svcName)) Then
|
||||||
|
isSuccess = false
|
||||||
|
writeLog "The " & KTLUCENE & " KnowledgeTree service could not be started. Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
Else
|
||||||
|
writeLog "The " & KTLUCENE & " KnowledgeTree service was successfully started"
|
||||||
|
End If
|
||||||
|
|
||||||
|
writeLog "Successfully started " & KTLUCENE
|
||||||
|
Else
|
||||||
|
writeLog KTLUCENE & " already started. Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
End If
|
||||||
|
|
||||||
|
If (isSuccess) Then
|
||||||
|
Wscript.Echo "The " & KTLUCENE & " KnowledgeTree service was successfully started"
|
||||||
|
Else
|
||||||
|
Wscript.Echo "The " & KTLUCENE & " KnowledgeTree service could not be started. Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
End If
|
||||||
|
End Select
|
||||||
|
Else
|
||||||
|
isSuccess = TRUE
|
||||||
|
|
||||||
|
svcName = KTOFFICE
|
||||||
|
If (NOT isServiceStarted(svcName)) Then
|
||||||
|
If (NOT startService(svcName)) Then
|
||||||
|
isSuccess = false
|
||||||
|
writeLog "Couldn't start. " & KTOFFICE & " Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
Else
|
||||||
|
writeLog "Successfully started " & KTOFFICE
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
writeLog KTOFFICE & " already started. Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
End If
|
||||||
|
|
||||||
|
svcName = KTSCHEDULER
|
||||||
|
If (NOT isServiceStarted(svcName)) Then
|
||||||
|
If (NOT startService(svcName)) Then
|
||||||
|
isSuccess = false
|
||||||
|
writeLog "Couldn't start " & KTSCHEDULER & " Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
Else
|
||||||
|
writeLog "Successfully started " & KTSCHEDULER
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
writeLog KTSCHEDULER & " already started. Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
End If
|
||||||
|
|
||||||
|
svcName = KTLUCENE
|
||||||
|
If (NOT isServiceStarted(svcName)) Then
|
||||||
|
If (NOT startService(svcName)) Then
|
||||||
|
isSuccess = false
|
||||||
|
writeLog "Couldn't start " & KTLUCENE & " Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
Else
|
||||||
|
writeLog "Successfully started " & KTLUCENE
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
writeLog KTLUCENE & " already started. Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
End If
|
||||||
|
|
||||||
|
If (isSuccess) Then
|
||||||
|
Wscript.Echo "The KnowledgeTree services were successfully started"
|
||||||
|
Else
|
||||||
|
Wscript.Echo "There were errors starting the KnowledgeTree services please see the log for details ('knowledgetree/var/log/dmsctl.log')"
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Case "stop"
|
||||||
|
If (objArgs.count > 1) Then
|
||||||
|
Select Case objArgs.Item(1)
|
||||||
|
Case "soffice"
|
||||||
|
isSuccess = TRUE
|
||||||
|
svcName = KTOFFICE
|
||||||
|
If (isServiceStarted(svcName)) Then
|
||||||
|
If (NOT stopService(svcName)) Then
|
||||||
|
isSuccess = false
|
||||||
|
writeLog "The " & KTOFFICE & " KnowledgeTree service could not be stopped. Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
Else
|
||||||
|
writeLog "The " & KTOFFICE & " KnowledgeTree service was successfully stopped"
|
||||||
|
End If
|
||||||
|
|
||||||
|
writeLog "Successfully stopped " & KTOFFICE
|
||||||
|
Else
|
||||||
|
writeLog KTOFFICE & " already stopped. Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
End If
|
||||||
|
|
||||||
|
If (isSuccess) Then
|
||||||
|
Wscript.Echo "The " & KTOFFICE & " KnowledgeTree service was successfully stopped"
|
||||||
|
Else
|
||||||
|
Wscript.Echo "The " & KTOFFICE & " KnowledgeTree service could not be stopped. Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
End If
|
||||||
|
|
||||||
|
Case "scheduler"
|
||||||
|
isSuccess = TRUE
|
||||||
|
svcName = KTSCHEDULER
|
||||||
|
If (isServiceStarted(svcName)) Then
|
||||||
|
If (NOT stopService(svcName)) Then
|
||||||
|
isSuccess = false
|
||||||
|
writeLog "The " & KTSCHEDULER & " KnowledgeTree service could not be stopped. Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
Else
|
||||||
|
writeLog "The " & KTSCHEDULER & " KnowledgeTree service was successfully stopped"
|
||||||
|
End If
|
||||||
|
|
||||||
|
writeLog "Successfully stopped " & KTSCHEDULER
|
||||||
|
Else
|
||||||
|
writeLog KTSCHEDULER & " already stopped. Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
End If
|
||||||
|
|
||||||
|
If (isSuccess) Then
|
||||||
|
Wscript.Echo "The " & KTSCHEDULER & " KnowledgeTree service was successfully stopped"
|
||||||
|
Else
|
||||||
|
Wscript.Echo "The " & KTSCHEDULER & " KnowledgeTree service could not be stopped. Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
End If
|
||||||
|
|
||||||
|
Case "lucene"
|
||||||
|
isSuccess = TRUE
|
||||||
|
svcName = KTLUCENE
|
||||||
|
If (isServiceStarted(svcName)) Then
|
||||||
|
If (NOT stopService(svcName)) Then
|
||||||
|
isSuccess = false
|
||||||
|
writeLog "The " & KTLUCENE & " KnowledgeTree service could not be stopped. Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
Else
|
||||||
|
writeLog "The " & KTLUCENE & " KnowledgeTree service was successfully stopped"
|
||||||
|
End If
|
||||||
|
|
||||||
|
writeLog "Successfully stopped " & KTLUCENE
|
||||||
|
Else
|
||||||
|
writeLog KTLUCENE & " already stopped. Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
End If
|
||||||
|
|
||||||
|
If (isSuccess) Then
|
||||||
|
Wscript.Echo "The " & KTLUCENE & " KnowledgeTree service was successfully stopped"
|
||||||
|
Else
|
||||||
|
Wscript.Echo "The " & KTLUCENE & " KnowledgeTree service could not be stopped. Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
End If
|
||||||
|
End Select
|
||||||
|
Else
|
||||||
|
'Stopping all the services
|
||||||
|
isSuccess = TRUE
|
||||||
|
|
||||||
|
svcName = KTOFFICE
|
||||||
|
If (isServiceStarted(svcName)) Then
|
||||||
|
If (NOT stopService(svcName)) Then
|
||||||
|
isSuccess = false
|
||||||
|
writeLog "Couldn't stop." & KTOFFICE & " Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
Else
|
||||||
|
writeLog "Successfully stopped " & KTOFFICE
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
writeLog KTOFFICE & " already stopped. Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
End If
|
||||||
|
|
||||||
|
svcName = KTSCHEDULER
|
||||||
|
If (isServiceStarted(svcName)) Then
|
||||||
|
If (NOT stopService(svcName)) Then
|
||||||
|
isSuccess = false
|
||||||
|
writeLog "Couldn't stop." & KTSCHEDULER & " Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
Else
|
||||||
|
writeLog "Successfully stopped " & KTSCHEDULER
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
writeLog KTSCHEDULER & " already stopped. Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
End If
|
||||||
|
|
||||||
|
svcName = KTLUCENE
|
||||||
|
If (isServiceStarted(svcName)) Then
|
||||||
|
If (NOT stopService(svcName)) Then
|
||||||
|
isSuccess = false
|
||||||
|
writeLog "Couldn't stop." & KTLUCENE & " Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
Else
|
||||||
|
writeLog "Successfully stopped " & KTLUCENE
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
writeLog KTLUCENE & " already stopped. Result Code: " & getServiceErrorMessage(lastErrorCode)
|
||||||
|
End If
|
||||||
|
|
||||||
|
If (isSuccess) Then
|
||||||
|
Wscript.Echo "The KnowledgeTree services were successfully stopped"
|
||||||
|
Else
|
||||||
|
Wscript.Echo "There were errors sopping the KnowledgeTree services please see the log for details ('knowledgetree/var/log/dmsctl.log')"
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Case "uninstall"
|
||||||
|
isSuccess = TRUE
|
||||||
|
|
||||||
|
svcName = KTOFFICE
|
||||||
|
If (NOT uninstallService(svcName)) Then
|
||||||
|
isSuccess = false
|
||||||
|
writeLog "The KnowledgeTree KTOffice service could not be uninstalled"
|
||||||
|
End If
|
||||||
|
|
||||||
|
svcName = KTSCHEDULER
|
||||||
|
If (NOT uninstallService(svcName)) Then
|
||||||
|
isSuccess = false
|
||||||
|
writeLog "The KnowledgeTree KTScheduler service could not be uninstalled"
|
||||||
|
End If
|
||||||
|
|
||||||
|
svcName = KTLUCENE
|
||||||
|
If (NOT uninstallService(svcName)) Then
|
||||||
|
isSuccess = false
|
||||||
|
writeLog "The KnowledgeTree KTLucene service could not be uninstalled"
|
||||||
|
End If
|
||||||
|
|
||||||
|
If (isSuccess) Then
|
||||||
|
Wscript.Echo "The KnowledgeTree services were uninstalled"
|
||||||
|
Else
|
||||||
|
Wscript.Echo "There were errors uninstalling the KnowledgeTree services please see the log for details ('knowledgetree/var/log/dmsctl.log')"
|
||||||
|
End If
|
||||||
|
|
||||||
|
Case "uninstall_old" 'Depricated : This method prevents verbose error logging, using WMI to uninstall instead
|
||||||
|
isSuccess = TRUE ' Track if anything went wrong
|
||||||
|
|
||||||
|
' Stopping Then FALSE
|
||||||
|
'svcName = KTOFFICE
|
||||||
|
'If (isServiceStarted(svcName)) Then
|
||||||
|
' If (NOT stopService(svcName)) Then
|
||||||
|
' isSuccess = false
|
||||||
|
' End If
|
||||||
|
'End If
|
||||||
|
|
||||||
|
' FALSE KTOffice
|
||||||
|
result = exec("sc delete " & KTOFFICE)
|
||||||
|
|
||||||
|
'Uninstall Failed
|
||||||
|
If result = 0 Then
|
||||||
|
isSuccess = false
|
||||||
|
writeLog "The KnowledgeTree KTOffice service could not be uninstalled"
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Stopping Then FALSE
|
||||||
|
'svcName = KTSCHEDULER
|
||||||
|
'If (isServiceStarted(svcName)) Then
|
||||||
|
' If (NOT stopService(svcName)) Then
|
||||||
|
' isSuccess = false
|
||||||
|
' End If
|
||||||
|
'End If
|
||||||
|
|
||||||
|
' FALSE KTScheduler
|
||||||
|
result = exec("sc delete " & KTSCHEDULER)
|
||||||
|
|
||||||
|
'Uninstall Failed
|
||||||
|
If result = 0 Then
|
||||||
|
isSuccess = false
|
||||||
|
writeLog "The KnowledgeTree KTScheduler service could not be uninstalled"
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Stopping Then FALSE
|
||||||
|
'svcName = KTLUCENE
|
||||||
|
'If (isServiceStarted(svcName)) Then
|
||||||
|
' If (NOT stopService(svcName)) Then
|
||||||
|
' isSuccess = FALSE
|
||||||
|
' End If
|
||||||
|
'End If
|
||||||
|
|
||||||
|
' FALSE KTLucene
|
||||||
|
result = exec("sc delete " & KTLUCENE)
|
||||||
|
|
||||||
|
'Uninstall Failed
|
||||||
|
If result = 0 Then
|
||||||
|
isSuccess = FALSE
|
||||||
|
writeLog "The KnowledgeTree KTLucene service could not be uninstalled"
|
||||||
|
End If
|
||||||
|
|
||||||
|
If (isSuccess) Then
|
||||||
|
Wscript.Echo "The KnowledgeTree services were uninstalled"
|
||||||
|
Else
|
||||||
|
Wscript.Echo "There were errors uninstalling the KnowledgeTree services please see the log for details ('knowledgetree/var/log/dmsctl.log')"
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
Case Else
|
||||||
|
Wscript.Echo strUsage
|
||||||
|
End Select
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Method to check if a service is installed
|
||||||
|
Public Function isServiceInstalled(ByVal svcName)
|
||||||
|
strComputer = "."
|
||||||
|
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
|
||||||
|
|
||||||
|
' Obtain an instance of the the class
|
||||||
|
' using a key property value.
|
||||||
|
|
||||||
|
isServiceInstalled = FALSE
|
||||||
|
|
||||||
|
svcQry = "SELECT * from Win32_Service"
|
||||||
|
Set objOutParams = objWMIService.ExecQuery(svcQry)
|
||||||
|
|
||||||
|
For Each objSvc in objOutParams
|
||||||
|
|
||||||
|
Select Case objSvc.Name
|
||||||
|
Case svcName
|
||||||
|
isServiceInstalled = TRUE
|
||||||
|
End Select
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
If (Not isServiceInstalled) Then
|
||||||
|
lastErrorCode = SVC_INVALID_NAME
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
' Method to interrogate a service
|
||||||
|
Public Function isServiceStarted(ByVal svcName)
|
||||||
|
If (NOT isServiceInstalled( svcName )) Then
|
||||||
|
isServiceStarted = FALSE
|
||||||
|
Exit Function
|
||||||
|
End If
|
||||||
|
|
||||||
|
strComputer = "."
|
||||||
|
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
|
||||||
|
|
||||||
|
' Obtain an instance of the the class
|
||||||
|
' using a key property value.
|
||||||
|
Set objShare = objWMIService.Get("Win32_Service.Name='" & svcName & "'")
|
||||||
|
|
||||||
|
' no InParameters to define
|
||||||
|
|
||||||
|
' Execute the method and obtain the return status.
|
||||||
|
' The OutParameters object in objOutParams
|
||||||
|
' is created by the provider.
|
||||||
|
Set objOutParams = objWMIService.ExecMethod("Win32_Service.Name='" & svcName & "'", "InterrogateService")
|
||||||
|
|
||||||
|
lastErrorCode = objOutParams.ReturnValue
|
||||||
|
|
||||||
|
If (objOutParams.ReturnValue = SVC_SERVICE_NOT_ACTIVE) Then
|
||||||
|
isServiceStarted = FALSE
|
||||||
|
Else
|
||||||
|
isServiceStarted = TRUE
|
||||||
|
End If
|
||||||
|
|
||||||
|
end Function
|
||||||
|
|
||||||
|
' Method to start a service
|
||||||
|
Public Function startService(ByVal svcName)
|
||||||
|
If (NOT isServiceInstalled( svcName )) Then
|
||||||
|
writeLog "The KnowledgeTree " & svcName & " service could not be started because it isn't installed. Run 'dmsctl.vbs install' to correct."
|
||||||
|
startService = FALSE
|
||||||
|
Exit Function
|
||||||
|
End If
|
||||||
|
|
||||||
|
strComputer = "."
|
||||||
|
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
|
||||||
|
' Obtain an instance of the the class
|
||||||
|
' using a key property value.
|
||||||
|
Set objShare = objWMIService.Get("Win32_Service.Name='" & svcName &"'")
|
||||||
|
|
||||||
|
' no InParameters to define
|
||||||
|
|
||||||
|
' Execute the method and obtain the return status.
|
||||||
|
' The OutParameters object in objOutParams
|
||||||
|
' is created by the provider.
|
||||||
|
Set objOutParams = objWMIService.ExecMethod("Win32_Service.Name='" & svcName & "'", "StartService")
|
||||||
|
|
||||||
|
lastErrorCode = objOutParams.ReturnValue
|
||||||
|
|
||||||
|
If (objOutParams.ReturnValue = SVC_SUCCESS) Then
|
||||||
|
startService = TRUE
|
||||||
|
Else
|
||||||
|
startService = FALSE
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
' Method to stop a service
|
||||||
|
Public Function stopService(ByVal svcName)
|
||||||
|
If (NOT isServiceInstalled( svcName )) Then
|
||||||
|
writeLog "The KnowledgeTree " & svcName & " service could not be stopped because it isn't installed. Run 'dmsctl.vbs install' to correct."
|
||||||
|
stopService = FALSE
|
||||||
|
Exit Function
|
||||||
|
End If
|
||||||
|
|
||||||
|
strComputer = "."
|
||||||
|
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
|
||||||
|
' Obtain an instance of the the class
|
||||||
|
' using a key property value.
|
||||||
|
Set objShare = objWMIService.Get("Win32_Service.Name='" & svcName &"'")
|
||||||
|
|
||||||
|
' no InParameters to define
|
||||||
|
|
||||||
|
' Execute the method and obtain the return status.
|
||||||
|
' The OutParameters object in objOutParams
|
||||||
|
' is created by the provider.
|
||||||
|
Set objOutParams = objWMIService.ExecMethod("Win32_Service.Name='" & svcName & "'", "StopService")
|
||||||
|
|
||||||
|
lastErrorCode = objOutParams.ReturnValue
|
||||||
|
|
||||||
|
If (objOutParams.ReturnValue = SVC_SUCCESS) Then
|
||||||
|
stopService = TRUE
|
||||||
|
Else
|
||||||
|
stopService = FALSE
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
' Method to uninstall a service
|
||||||
|
Public Function uninstallService(ByVal svcName)
|
||||||
|
If (NOT isServiceInstalled( svcName )) Then
|
||||||
|
uninstallService = TRUE ' Service already uninstalled so return TRUE
|
||||||
|
Exit Function
|
||||||
|
End If
|
||||||
|
|
||||||
|
wasStopped = TRUE
|
||||||
|
If (NOT stopService(svcName)) Then
|
||||||
|
wasStopped = FALSE
|
||||||
|
End If
|
||||||
|
|
||||||
|
strComputer = "."
|
||||||
|
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
|
||||||
|
' Obtain an instance of the the class
|
||||||
|
' using a key property value.
|
||||||
|
Set objShare = objWMIService.Get("Win32_Service.Name='" & svcName & "'")
|
||||||
|
|
||||||
|
' no InParameters to define
|
||||||
|
|
||||||
|
' Execute the method and obtain the return status.
|
||||||
|
' The OutParameters object in objOutParams
|
||||||
|
' is created by the provider.
|
||||||
|
Set objOutParams = objWMIService.ExecMethod("Win32_Service.Name='" & svcName & "'", "Delete")
|
||||||
|
|
||||||
|
lastErrorCode = objOutParams.ReturnValue
|
||||||
|
|
||||||
|
If (objOutParams.ReturnValue = SVC_SUCCESS) Then
|
||||||
|
uninstallService = TRUE
|
||||||
|
Else
|
||||||
|
uninstallService = FALSE
|
||||||
|
|
||||||
|
' Extra Event logging to assist the Administrator
|
||||||
|
If (wasStopped) Then
|
||||||
|
writeLog "The KnowledgeTree " & svcName & " service could not be uninstalled because it could not be stopped. Stop this service manually before uninstalling."
|
||||||
|
uninstallService = FALSE ' Must be stop service before it can be uninstalled
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
' Execute a command
|
||||||
|
Public Function exec(ByVal cmd)
|
||||||
|
|
||||||
|
Dim WshShell, oExec
|
||||||
|
Set WshShell = CreateObject("WScript.Shell")
|
||||||
|
|
||||||
|
Set oExec = WshShell.Exec(cmd)
|
||||||
|
|
||||||
|
Do While oExec.Status = 0
|
||||||
|
WScript.Sleep 100
|
||||||
|
Loop
|
||||||
|
|
||||||
|
exec = oExec.Status
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Sub createCustomEventLog(ByVal strName)
|
||||||
|
Const NO_VALUE = Empty
|
||||||
|
|
||||||
|
Set WshShell = WScript.CreateObject("WScript.Shell")
|
||||||
|
WshShell.RegWrite _
|
||||||
|
"HKLM\System\CurrentControlSet\Services\EventLog\" & strName & "\", NO_VALUE
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
' Event logging only works on Server 2003, 2000 and XP
|
||||||
|
Public Sub logEvent(ByVal strMessage)
|
||||||
|
' Disabled until Windows Vista detection has been tested.
|
||||||
|
'If (NOT isWindowsVista() AND NOT isWindows7() AND NOT isWindows2008()) Then
|
||||||
|
' Const EVENT_SUCCESS = 0
|
||||||
|
' Set objShell = Wscript.CreateObject("Wscript.Shell")
|
||||||
|
' objShell.LogEvent EVENT_SUCCESS, strMessage
|
||||||
|
'End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
' Event logging only works on Server 2003, 2000 and XP
|
||||||
|
Public Sub writeLog(ByVal strMessage)
|
||||||
|
Set objFSO = CreateObject("Scripting.FileSystemObject")
|
||||||
|
ForAppending = 8
|
||||||
|
Set objTextFile = objFSO.OpenTextFile (currDir & "\var\log\dmsctl.log", ForAppending, True)
|
||||||
|
objTextFile.WriteLine strMessage
|
||||||
|
objTextFile.Close
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Function getServiceErrorMessage(ByVal errCode)
|
||||||
|
Select Case errCode
|
||||||
|
Case SVC_SUCCESS
|
||||||
|
getServiceErrorMessage = "Success"
|
||||||
|
Case SVC_NOT_SUPPORTED
|
||||||
|
getServiceErrorMessage = "Not Supported"
|
||||||
|
Case SVC_ACCESS_DENIED
|
||||||
|
getServiceErrorMessage = "Access Denied"
|
||||||
|
Case SVC_DEPENDENT_SERVICES_RUNNING
|
||||||
|
getServiceErrorMessage = "Dependent Services Running"
|
||||||
|
Case SVC_INVALID_SERVICE_CONTROL
|
||||||
|
getServiceErrorMessage = "Invalid Service Control"
|
||||||
|
Case SVC_SERVICE_CANNOT_ACCEPT_CONTROL
|
||||||
|
getServiceErrorMessage = "Service Cannot Accept Control"
|
||||||
|
Case SVC_SERVICE_NOT_ACTIVE
|
||||||
|
getServiceErrorMessage = "Service Not Active"
|
||||||
|
Case SVC_SERVICE_REQUEST_TIMEOUT
|
||||||
|
getServiceErrorMessage = "Service Request Timeout"
|
||||||
|
Case SVC_UNKNOWN_FAILURE
|
||||||
|
getServiceErrorMessage = "Unknown Failure"
|
||||||
|
Case SVC_PATH_NOT_FOUND
|
||||||
|
getServiceErrorMessage = "Path Not Found"
|
||||||
|
Case SVC_SERVICE_ALREADY_RUNNING
|
||||||
|
getServiceErrorMessage = "Service Already Running"
|
||||||
|
Case SVC_SERVICE_DATABASE_LOCKED
|
||||||
|
getServiceErrorMessage = "Service Database Locked"
|
||||||
|
Case SVC_SERVICE_DEPENDENCY_DELETED
|
||||||
|
getServiceErrorMessage = "Service Dependency Deleted"
|
||||||
|
Case SVC_SERVICE_DEPENDENCY_FAILURE
|
||||||
|
getServiceErrorMessage = "Service Dependency Failure"
|
||||||
|
Case SVC_SERVICE_DISABLED
|
||||||
|
getServiceErrorMessage = "Service Disabled"
|
||||||
|
Case SVC_SERVICE_LOGON_FAILURE
|
||||||
|
getServiceErrorMessage = "Service Logon Failure"
|
||||||
|
Case SVC_SERVICE_MARKED_FOR_DELETION
|
||||||
|
getServiceErrorMessage = "Service Marked For Deletion"
|
||||||
|
Case SVC_SERVICES_NO_THREAD
|
||||||
|
getServiceErrorMessage = "Service No Thread"
|
||||||
|
Case SVC_STATUS_CIRCULAR_DEPENDENCY
|
||||||
|
getServiceErrorMessage = "Status Circular Dependency"
|
||||||
|
Case SVC_STATUS_DUPLICATE_NAME
|
||||||
|
getServiceErrorMessage = "Status Duplicate Name"
|
||||||
|
Case SVC_INVALID_NAME
|
||||||
|
getServiceErrorMessage = "Status Invalid Name"
|
||||||
|
Case SVC_STATUS_INVALID_PARAMETER
|
||||||
|
getServiceErrorMessage = "Status Invalid Parameter"
|
||||||
|
Case SVC_INVALID_SERVICES_ACCOUNT
|
||||||
|
getServiceErrorMessage = "Status Invalid Service Account"
|
||||||
|
Case SVC_STATUS_SERVICE_EXISTS
|
||||||
|
getServiceErrorMessage = "Status Service Exists"
|
||||||
|
Case SVC_SERVICE_ALREADY_PAUSED
|
||||||
|
getServiceErrorMessage = "Service Already Paused"
|
||||||
|
Case Else
|
||||||
|
getServiceErrorMessage = "Unknown Failure"
|
||||||
|
End Select
|
||||||
|
End Function
|
||||||
3
dmsctl_install.bat
Normal file
3
dmsctl_install.bat
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
rem KnowledgeTree UAC Run installer as Administrator for Windows 7 and Vista
|
||||||
|
@echo off
|
||||||
|
call dmsctl.bat install
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user