Commit 06e9b0a05f520b4e6591724f24d979e6e3dd0b7b

Authored by kevin_fourie
1 parent 579dcb63

Merged in from DEV trunk...

KTS-3039
"The paths in the plugin_helper table can't contain both forward and backward slashes"
Fixed. Modified the function checking the absolute path. On registering the plugin helper, all back slashes are changed to forward slashes.

Committed By: Megan Watson
Reviewed By: Conrad Vermeulen

KTC-382
"The version history dies if the document comparison plugin is enabled but no license is installed"
Fixed. Added a check on loading the plugin, load returns false if the license is not installed.

Committed By: Megan Watson
Reviewed By: Conrad Vermeulen

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@8066 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/plugins/plugin.inc.php
... ... @@ -356,12 +356,14 @@ class KTPlugin {
356 356 if (empty($sFilename)) {
357 357 $sFilename = $this->sFilename;
358 358 }
  359 +
359 360 if (!KTUtil::isAbsolutePath($sFilename)) {
360 361 if ($this->sFilename) {
361 362 $sDirPath = dirname($this->sFilename);
362 363 $sFilename = sprintf("%s/%s", $sDirPath, $sFilename);
363 364 }
364 365 }
  366 + $sFilename = str_replace('\\', '/', $sFilename);
365 367 return $sFilename;
366 368 }
367 369  
... ...
lib/util/ktutil.inc
... ... @@ -749,6 +749,11 @@ class KTUtil {
749 749 // {{{ isAbsolutePath
750 750 static function isAbsolutePath($sPath) {
751 751  
  752 + $sPath = str_replace('\\', '/', $sPath);
  753 + $sReal = str_replace('\\', '/', realpath($sPath));
  754 +
  755 + return ($sReal == $sPath);
  756 +
752 757 if (substr($sPath, 0, 1) == '/') {
753 758 return true;
754 759 }
... ...
plugins/ktcore/KTDocumentActions.php
... ... @@ -171,15 +171,17 @@ class KTDocumentVersionHistoryAction extends KTDocumentAction {
171 171  
172 172 if($isActive){
173 173 $oRegistry =& KTPluginRegistry::getSingleton();
174   - $oPlugin =& $oRegistry->getPlugin('document.comparison.plugin');
175   - $oPlugin->load();
176   - $sUrl = $oPlugin->getPagePath('DocumentComparison');
177   - $file = $oPlugin->_aPages['document.comparison.plugin/DocumentComparison'][2];
  174 + $oPlugin =& $oRegistry->getPlugin('document.comparison.plugin');
  175 +
  176 + if($oPlugin->load()){
  177 + $sUrl = $oPlugin->getPagePath('DocumentComparison');
  178 + $file = $oPlugin->_aPages['document.comparison.plugin/DocumentComparison'][2];
178 179  
179   - include_once($file);
  180 + include_once($file);
180 181  
181   - // Check mime type of document for content comparison
182   - list($bShowCompare, $bShowVersionCompare) = DocumentComparison::checkMimeType($this->oDocument);
  182 + // Check mime type of document for content comparison
  183 + list($bShowCompare, $bShowVersionCompare) = DocumentComparison::checkMimeType($this->oDocument);
  184 + }
183 185 }
184 186  
185 187 $aTemplateData = array(
... ...