diff --git a/config/dmsDefaults.php b/config/dmsDefaults.php
index 4fae381..2cf656d 100644
--- a/config/dmsDefaults.php
+++ b/config/dmsDefaults.php
@@ -636,7 +636,8 @@ if ($checkup !== true) {
if ($checkup !== true) {
if (KTPluginUtil::pluginIsActive('ktdms.wintools')) {
- require_once(KT_DIR . '/plugins/wintools/baobabkeyutil.inc.php');
+ $path = KTPluginUtil::getPluginPath('ktdms.wintools');
+ require_once($path . 'baobabkeyutil.inc.php');
$name = BaobabKeyUtil::getName();
if ($name) {
$default->versionName = sprintf('%s %s', $default->versionName, $name);
diff --git a/lib/plugins/plugin.inc.php b/lib/plugins/plugin.inc.php
index e96b106..b35b71b 100644
--- a/lib/plugins/plugin.inc.php
+++ b/lib/plugins/plugin.inc.php
@@ -713,6 +713,8 @@ class KTPlugin {
$oEntity = KTPluginEntity::getByNamespace($this->sNamespace);
$friendly_name = '';
$iOrder = $this->iOrder;
+ global $default;
+
if (!empty($this->sFriendlyName)) { $friendly_name = $this->sFriendlyName; }
if (!PEAR::isError($oEntity)) {
@@ -724,6 +726,8 @@ class KTPlugin {
$iEndVersion = $this->upgradePlugin($oEntity->getVersion()+1, $this->iVersion);
if ($iEndVersion != $this->iVersion) {
+ $default->log->error("Plugin register: {$friendly_name}, namespace: {$this->sNamespace} failed to upgrade properly. Original version: {$oEntity->getVersion()}, upgrading to version {$this->iVersion}, current version {$iEndVersion}");
+
// we obviously failed.
$oEntity->updateFromArray(array(
'path' => $this->stripKtDir($this->sFilename),
@@ -735,6 +739,8 @@ class KTPlugin {
// FIXME we -really- need to raise an error here, somehow.
} else {
+ $default->log->debug("Plugin register: {$friendly_name}, namespace: {$this->sNamespace} upgraded. Original version: {$oEntity->getVersion()}, upgrading to version {$this->iVersion}, current version {$iEndVersion}");
+
$oEntity->updateFromArray(array(
'path' => $this->stripKtDir($this->sFilename),
'version' => $this->iVersion,
@@ -750,6 +756,7 @@ class KTPlugin {
return $oEntity;
}
if(PEAR::isError($oEntity) && !is_a($oEntity, 'KTEntityNoObjects')){
+ $default->log->error("Plugin register: the plugin {$friendly_name}, namespace: {$this->sNamespace} returned an error: ".$oEntity->getMessage());
return $oEntity;
}
@@ -759,6 +766,8 @@ class KTPlugin {
$disabled = 0;
}
+ $default->log->debug("Plugin register: creating {$friendly_name}, namespace: {$this->sNamespace}");
+
$iEndVersion = $this->upgradePlugin(0, $this->iVersion);
$oEntity = KTPluginEntity::createFromArray(array(
'namespace' => $this->sNamespace,
@@ -771,6 +780,7 @@ class KTPlugin {
));
if (PEAR::isError($oEntity)) {
+ $default->log->error("Plugin register: the plugin, {$friendly_name}, namespace: {$this->sNamespace} returned an error on creation: ".$oEntity->getMessage());
return $oEntity;
}
diff --git a/lib/plugins/pluginentity.inc.php b/lib/plugins/pluginentity.inc.php
index 9ff54ca..34b6086 100644
--- a/lib/plugins/pluginentity.inc.php
+++ b/lib/plugins/pluginentity.inc.php
@@ -6,31 +6,31 @@
* Document Management Made Simple
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
* Portions copyright The Jam Warehouse Software (Pty) Limited
- *
+ *
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation.
- *
+ *
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
- * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
+ *
+ * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
* California 94120-7775, or email info@knowledgetree.com.
- *
+ *
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
- *
+ *
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
- * KnowledgeTree" logo and retain the original copyright notice. If the display of the
+ * KnowledgeTree" logo and retain the original copyright notice. If the display of the
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
- * must display the words "Powered by KnowledgeTree" and retain the original
+ * must display the words "Powered by KnowledgeTree" and retain the original
* copyright notice.
* Contributor( s): ______________________________________
*
@@ -111,7 +111,7 @@ class KTPluginEntity extends KTEntity {
// STATIC
function &getAvailable() {
- $aOptions = array('multi' => true);
+ $aOptions = array('multi' => true, 'orderby' => 'friendly_name');
return KTEntityUtil::getBy('KTPluginEntity', 'unavailable', false, $aOptions);
}
diff --git a/lib/plugins/pluginutil.inc.php b/lib/plugins/pluginutil.inc.php
index 0bd9235..c73b638 100644
--- a/lib/plugins/pluginutil.inc.php
+++ b/lib/plugins/pluginutil.inc.php
@@ -525,7 +525,7 @@ class KTPluginUtil {
}
return false;
}
-
+
/* Get the priority of the plugin */
function getPluginPriority($sFile) {
$defaultPriority = 10;
@@ -560,7 +560,7 @@ class KTPluginUtil {
$files = array();
$plugins = array();
-
+
KTPluginUtil::_walk(KT_DIR . '/plugins', $files);
foreach ($files as $sFile) {
$plugin_ending = "Plugin.php";
@@ -569,17 +569,17 @@ class KTPluginUtil {
$plugins[$sFile] = KTPluginUtil::getPluginPriority($sFile);
}
}
-
+
/* Sort the plugins by priority */
asort($plugins);
-
+
foreach($plugins as $sFile => $priority) {
require_once($sFile);
}
-
-
-
-
+
+
+
+
$oRegistry =& KTPluginRegistry::getSingleton();
$aRegistryList = $oRegistry->getPlugins();
@@ -687,15 +687,34 @@ class KTPluginUtil {
}
}
- // utility function to detect if the plugin is loaded and active.
- static function pluginIsActive($sNamespace) {
+ /**
+ * Get the full path to the plugin
+ *
+ * @param string $sNamespace The namespace of the plugin
+ * @param bool $relative Whether the path should be relative or full
+ * @return string
+ */
+ static function getPluginPath($sNamespace, $relative = false)
+ {
+ $oEntity = KTPluginEntity::getByNamespace($sNamespace);
+ if(PEAR::isError($oEntity)){
+ return $oEntity;
+ }
+ $dir = dirname($oEntity->getPath()) . DIRECTORY_SEPARATOR;
+ if(!$relative){
+ $dir = KT_DIR . DIRECTORY_SEPARATOR . $dir;
+ }
- $oReg =& KTPluginRegistry::getSingleton();
- $plugin = $oReg->getPlugin($sNamespace);
+ return $dir;
+ }
+ // utility function to detect if the plugin is loaded and active.
+ static function pluginIsActive($sNamespace) {
+ $oReg =& KTPluginRegistry::getSingleton();
+ $plugin = $oReg->getPlugin($sNamespace);
if (is_null($plugin) || PEAR::isError($plugin)) { return false; } // no such plugin
else { // check if its active
@@ -709,4 +728,4 @@ class KTPluginUtil {
}
}
-?>
+?>
\ No newline at end of file
diff --git a/lib/session/Session.inc b/lib/session/Session.inc
index 3cca465..6aecd26 100644
--- a/lib/session/Session.inc
+++ b/lib/session/Session.inc
@@ -56,7 +56,8 @@ class Session {
// Don't need to lock a user out the web interface if KT Tools exists and has no license.
if (KTPluginUtil::pluginIsActive('ktdms.wintools')) {
if (!$oUser->isAnonymous()) {
- require_once(KT_DIR . '/plugins/wintools/baobabkeyutil.inc.php');
+ $path = KTPluginUtil::getPluginPath('ktdms.wintools');
+ require_once($path . 'baobabkeyutil.inc.php');
$res = BaobabKeyUtil::isValidUser($oUser);
if (PEAR::isError($res)) {
return $res;
@@ -236,7 +237,7 @@ class Session {
}
// this should be an existing session, so check the db
- $aRows = DBUtil::getResultArray(array("SELECT * FROM $default->sessions_table WHERE session_id = ?", $sessionID));
+ $aRows = DBUtil::getResultArray(array("SELECT * FROM $default->sessions_table WHERE session_id = ? ORDER BY id DESC", $sessionID));
$numrows = count($aRows);
diff --git a/lib/templating/kt3template.inc.php b/lib/templating/kt3template.inc.php
index 7b82d69..71e428e 100644
--- a/lib/templating/kt3template.inc.php
+++ b/lib/templating/kt3template.inc.php
@@ -101,6 +101,9 @@ class KTPage {
global $default;
$oConfig = KTConfig::getSingleton();
+ // set the system url
+ $this->systemURL = $oConfig->get('ui/systemUrl');
+
/* default css files initialisation */
$aCSS = Array(
"thirdpartyjs/extjs/resources/css/ext-all.css",
diff --git a/lib/users/User.inc b/lib/users/User.inc
index 01af973..96b949e 100644
--- a/lib/users/User.inc
+++ b/lib/users/User.inc
@@ -465,7 +465,8 @@ class User extends KTEntity {
$this->setDisabled(1);
$this->update();
if (KTPluginUtil::pluginIsActive('ktdms.wintools')) {
- require_once(KT_DIR . '/plugins/wintools/baobabkeyutil.inc.php');
+ $path = KTPluginUtil::getPluginPath('ktdms.wintools');
+ require_once($path . 'baobabkeyutil.inc.php');
BaobabKeyUtil::deallocateUser($this);
}
return;
@@ -475,7 +476,8 @@ class User extends KTEntity {
$this->setDisabled(0);
$this->update();
if (KTPluginUtil::pluginIsActive('ktdms.wintools')) {
- require_once(KT_DIR . '/plugins/wintools/baobabkeyutil.inc.php');
+ $path = KTPluginUtil::getPluginPath('ktdms.wintools');
+ require_once($path . 'baobabkeyutil.inc.php');
BaobabKeyUtil::allocateUser($this);
}
return;
@@ -483,7 +485,8 @@ class User extends KTEntity {
function create() {
if (KTPluginUtil::pluginIsActive('ktdms.wintools')) {
- require_once(KT_DIR . '/plugins/wintools/baobabkeyutil.inc.php');
+ $path = KTPluginUtil::getPluginPath('ktdms.wintools');
+ require_once($path . 'baobabkeyutil.inc.php');
$res = BaobabKeyUtil::canAddUser();
if (PEAR::isError($res)) {
return $res;
@@ -516,7 +519,8 @@ class User extends KTEntity {
$this->update();
if (KTPluginUtil::pluginIsActive('ktdms.wintools')) {
- require_once(KT_DIR . '/plugins/wintools/baobabkeyutil.inc.php');
+ $path = KTPluginUtil::getPluginPath('ktdms.wintools');
+ require_once($path . 'baobabkeyutil.inc.php');
BaobabKeyUtil::deallocateUser($this);
}
return;
diff --git a/plugins/ktcore/KTCorePlugin.php b/plugins/ktcore/KTCorePlugin.php
index 5c45f54..944b874 100644
--- a/plugins/ktcore/KTCorePlugin.php
+++ b/plugins/ktcore/KTCorePlugin.php
@@ -108,14 +108,14 @@ class KTCorePlugin extends KTPlugin {
$this->registerDashlet('KTCheckoutDashlet', 'ktcore.dashlet.checkout', 'KTDashlets.php');
$this->registerDashlet('KTMailServerDashlet', 'ktcore.dashlet.mail_server', 'KTDashlets.php');
$this->registerDashlet('LuceneMigrationDashlet', 'ktcore.dashlet.lucene_migration', KT_DIR . '/plugins/search2/MigrationDashlet.php');
-
-
+
+
// THESE THREE DASHLETS HAVE BEEN MOVED TO ADMIN PAGES
-
+
//$this->registerDashlet('ExternalResourceStatusDashlet', 'ktcore.dashlet.resource_status', KT_DIR . '/plugins/search2/ExternalDashlet.php');
//$this->registerDashlet('IndexingStatusDashlet', 'ktcore.dashlet.indexing_status', KT_DIR . '/plugins/search2/IndexingStatusDashlet.php');
//$this->registerDashlet('LuceneStatisticsDashlet', 'ktcore.dashlet.indexing_statss', KT_DIR . '/plugins/search2/LuceneStatisticsDashlet.php');
-
+
$this->registerDashlet('schedulerDashlet', 'ktcore.schedulerdashlet.plugin', 'scheduler/schedulerDashlet.php');
$this->registerAdminPage('scheduler', 'manageSchedulerDispatcher', 'misc', _kt('Manage Task Scheduler'), _kt('Manage the task scheduler'), 'scheduler/taskScheduler.php');
@@ -279,13 +279,6 @@ class KTCorePlugin extends KTPlugin {
_kt('Document Fieldsets'),
_kt('Manage the different types of information that can be associated with classes of documents.'),
'admin/documentFieldsv2.php', null);
- if(KTPluginUtil::pluginIsActive('ktdms.wintools'))
- {
- $this->registerAdminPage('emailtypemanagement', 'KTEmailDocumentTypeDispatcher', 'documents',
- _kt('Email Document Types'),
- _kt('Manage the addition of Email document types to the system.'),
- '../wintools/email/emailDocumentTypes.php', null);
- }
$this->registerAdminPage('workflows_2', 'KTWorkflowAdminV2', 'documents',
_kt('Workflows'), _kt('Configure automated Workflows that map to document life-cycles.'),
'admin/workflowsv2.php', null);
@@ -322,20 +315,20 @@ class KTCorePlugin extends KTPlugin {
$this->registerAdminPage('reschedulealldocuments', 'RescheduleDocumentsDispatcher', 'search',
_kt('Reschedule all documents'), _kt('This function allows you to re-index your entire repository.'),
'../search2/reporting/RescheduleDocuments.php', null);
-
-
+
+
// Admin Pages for Previous Dashlets
$this->registerAdminPage('indexingstatus', 'IndexingStatusDispatcher', 'search',
_kt('Document Indexer and External Resource Dependancy Status'), _kt('This report will show the status of external dependencies and the document indexer.'),
'../search2/reporting/IndexingStatus.php', null);
-
+
$this->registerAdminPage('lucenestatistics', 'LuceneStatisticsDispatcher', 'search',
_kt('Document Indexer Statistics'), _kt('This report will show the Lucene Document Indexing Statistics '),
'../search2/reporting/LuceneStatistics.php', null);
-
-
-
-
+
+
+
+
//config
$this->registerAdminPage('emailconfigpage', 'EmailConfigPageDispatcher', 'config',
_kt('Email'), _kt('Define the sending email server address, email password, email port, and user name, and view and modify policies for emailing documents and attachments from KnowledgeTree.'),
diff --git a/plugins/ktcore/admin/userManagement.php b/plugins/ktcore/admin/userManagement.php
index 0cc1145..5f512ff 100755
--- a/plugins/ktcore/admin/userManagement.php
+++ b/plugins/ktcore/admin/userManagement.php
@@ -6,31 +6,31 @@
* Document Management Made Simple
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
* Portions copyright The Jam Warehouse Software (Pty) Limited
- *
+ *
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation.
- *
+ *
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
- * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
+ *
+ * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
* California 94120-7775, or email info@knowledgetree.com.
- *
+ *
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
- *
+ *
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
- * KnowledgeTree" logo and retain the original copyright notice. If the display of the
+ * KnowledgeTree" logo and retain the original copyright notice. If the display of the
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
- * must display the words "Powered by KnowledgeTree" and retain the original
+ * must display the words "Powered by KnowledgeTree" and retain the original
* copyright notice.
* Contributor( s): ______________________________________
*
@@ -93,7 +93,8 @@ class KTUserAdminDispatcher extends KTAdminDispatcher {
$bCanAdd = true;
if (KTPluginUtil::pluginIsActive('ktdms.wintools')) {
- require_once(KT_DIR . '/plugins/wintools/baobabkeyutil.inc.php');
+ $path = KTPluginUtil::getPluginPath('ktdms.wintools');
+ require_once($path . 'baobabkeyutil.inc.php');
$bCanAdd = BaobabKeyUtil::canAddUser();
if (PEAR::isError($bCanAdd)) {
$bCanAdd = false;
@@ -697,7 +698,8 @@ class KTUserAdminDispatcher extends KTAdminDispatcher {
$iLicenses = 0;
$bRequireLicenses = false;
if (KTPluginUtil::pluginIsActive('ktdms.wintools')) {
- require_once(KT_DIR . '/plugins/wintools/baobabkeyutil.inc.php');
+ $path = KTPluginUtil::getPluginPath('ktdms.wintools');
+ require_once($path . 'baobabkeyutil.inc.php');
$iLicenses = BaobabKeyUtil::getLicenseCount();
$bRequireLicenses = true;
}
diff --git a/plugins/ktstandard/KTWebDAVDashletPlugin.php b/plugins/ktstandard/KTWebDAVDashletPlugin.php
index 6200521..846f3ef 100644
--- a/plugins/ktstandard/KTWebDAVDashletPlugin.php
+++ b/plugins/ktstandard/KTWebDAVDashletPlugin.php
@@ -76,8 +76,7 @@ class KTWebDAVDashlet extends KTBaseDashlet {
// Shortcut: Check if the the wintools plugin exists and set to true.
// Long way: Check that a license is installed - this is only text so having a license is not a requirement.
$isComm = false;
- $keyUtil = KT_DIR . '/plugins/wintools/baobabkeyutil.inc.php';
- if(file_exists($keyUtil)){
+ if (KTPluginUtil::pluginIsActive('ktdms.wintools')) {
$isComm = true;
}
$webdavUrl = $sURL.'/ktwebdav/ktwebdav.php';