Commit 56368afe8f89215e2fa5a9e2b7ff7582e6ddee08
1 parent
543f5be3
KTS-2178
"cross site scripting" Updated. Reviewed By: Kevin Fourie git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@6915 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
78 additions
and
78 deletions
lib/browse/Criteria.inc
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | * License Version 1.1.2 ("License"); You may not use this file except in | 8 | * License Version 1.1.2 ("License"); You may not use this file except in |
| 9 | * compliance with the License. You may obtain a copy of the License at | 9 | * compliance with the License. You may obtain a copy of the License at |
| 10 | * http://www.knowledgetree.com/KPL | 10 | * http://www.knowledgetree.com/KPL |
| 11 | - * | 11 | + * |
| 12 | * Software distributed under the License is distributed on an "AS IS" | 12 | * Software distributed under the License is distributed on an "AS IS" |
| 13 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. | 13 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing rights and | 14 | * See the License for the specific language governing rights and |
| @@ -19,9 +19,9 @@ | @@ -19,9 +19,9 @@ | ||
| 19 | * (ii) the KnowledgeTree copyright notice | 19 | * (ii) the KnowledgeTree copyright notice |
| 20 | * in the same form as they appear in the distribution. See the License for | 20 | * in the same form as they appear in the distribution. See the License for |
| 21 | * requirements. | 21 | * requirements. |
| 22 | - * | 22 | + * |
| 23 | * The Original Code is: KnowledgeTree Open Source | 23 | * The Original Code is: KnowledgeTree Open Source |
| 24 | - * | 24 | + * |
| 25 | * The Initial Developer of the Original Code is The Jam Warehouse Software | 25 | * The Initial Developer of the Original Code is The Jam Warehouse Software |
| 26 | * (Pty) Ltd, trading as KnowledgeTree. | 26 | * (Pty) Ltd, trading as KnowledgeTree. |
| 27 | * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright | 27 | * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright |
| @@ -92,7 +92,7 @@ class BrowseCriterion { | @@ -92,7 +92,7 @@ class BrowseCriterion { | ||
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | function parameterDisplay($aData) { | 94 | function parameterDisplay($aData) { |
| 95 | - return sprintf("%s %s", $this->baseParameterDisplay(), $aData[$this->getWidgetBase()]); | 95 | + return sprintf("%s %s", $this->baseParameterDisplay(), htmlentities($aData[$this->getWidgetBase()],ENT_QUOTES, 'UTF-8')); |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | function folderQuery ($iParentID, $sSortDirection) { | 98 | function folderQuery ($iParentID, $sSortDirection) { |
| @@ -144,7 +144,7 @@ class BrowseCriterion { | @@ -144,7 +144,7 @@ class BrowseCriterion { | ||
| 144 | // $sSortField = $this->getSortField(); | 144 | // $sSortField = $this->getSortField(); |
| 145 | $documentQuery .= "ORDER BY " . $this->getSortField() . " " . $sSortDirection; | 145 | $documentQuery .= "ORDER BY " . $this->getSortField() . " " . $sSortDirection; |
| 146 | } | 146 | } |
| 147 | - | 147 | + |
| 148 | return array($documentQuery, $aParams); | 148 | return array($documentQuery, $aParams); |
| 149 | } | 149 | } |
| 150 | 150 | ||
| @@ -176,7 +176,7 @@ class BrowseCriterion { | @@ -176,7 +176,7 @@ class BrowseCriterion { | ||
| 176 | function getID() { | 176 | function getID() { |
| 177 | return $this->iID; | 177 | return $this->iID; |
| 178 | } | 178 | } |
| 179 | - | 179 | + |
| 180 | function getNameSpace() { | 180 | function getNameSpace() { |
| 181 | return $this->sNamespace; | 181 | return $this->sNamespace; |
| 182 | } | 182 | } |
| @@ -203,10 +203,10 @@ class BrowseCriterion { | @@ -203,10 +203,10 @@ class BrowseCriterion { | ||
| 203 | return $this->getNotWidget($aPreValue) . "<input type=\"text\" size=\"50\" name=\"" . $this->getWidgetBase() . "\" />"; | 203 | return $this->getNotWidget($aPreValue) . "<input type=\"text\" size=\"50\" name=\"" . $this->getWidgetBase() . "\" />"; |
| 204 | } | 204 | } |
| 205 | } | 205 | } |
| 206 | - | 206 | + |
| 207 | function getNotWidget($aPreValue=null) { | 207 | function getNotWidget($aPreValue=null) { |
| 208 | if (!$this->bHandleNot) { return ''; } | 208 | if (!$this->bHandleNot) { return ''; } |
| 209 | - | 209 | + |
| 210 | // not perfect, but acceptable. | 210 | // not perfect, but acceptable. |
| 211 | $form_name = $this->getWidgetBase() . '_not'; | 211 | $form_name = $this->getWidgetBase() . '_not'; |
| 212 | $pos_select = ''; | 212 | $pos_select = ''; |
| @@ -229,7 +229,7 @@ class BrowseCriterion { | @@ -229,7 +229,7 @@ class BrowseCriterion { | ||
| 229 | $is_string = _kt('is'); | 229 | $is_string = _kt('is'); |
| 230 | } else { | 230 | } else { |
| 231 | $not_string = _kt('does not contain'); | 231 | $not_string = _kt('does not contain'); |
| 232 | - $is_string = _kt('contains'); | 232 | + $is_string = _kt('contains'); |
| 233 | } | 233 | } |
| 234 | $widget = sprintf('<select name="%s"><option value="0"%s>%s</option><option value="1"%s>%s</option></select> ', $form_name, $pos_select, $is_string, $neg_select, $not_string); | 234 | $widget = sprintf('<select name="%s"><option value="0"%s>%s</option><option value="1"%s>%s</option></select> ', $form_name, $pos_select, $is_string, $neg_select, $not_string); |
| 235 | return $widget; | 235 | return $widget; |
| @@ -254,14 +254,14 @@ class BrowseCriterion { | @@ -254,14 +254,14 @@ class BrowseCriterion { | ||
| 254 | // handle the boolean "not" stuff UNLESS our caller is doing so already. | 254 | // handle the boolean "not" stuff UNLESS our caller is doing so already. |
| 255 | if ($handle_not) { | 255 | if ($handle_not) { |
| 256 | $want_invert = KTUtil::arrayGet($aRequest, $this->getWidgetBase() . '_not'); | 256 | $want_invert = KTUtil::arrayGet($aRequest, $this->getWidgetBase() . '_not'); |
| 257 | - | 257 | + |
| 258 | if (is_null($want_invert) || ($want_invert == "0")) { // use explicit "0" check | 258 | if (is_null($want_invert) || ($want_invert == "0")) { // use explicit "0" check |
| 259 | return $val; | 259 | return $val; |
| 260 | } else { | 260 | } else { |
| 261 | $val[0] = '(NOT (' . $val[0] . '))'; | 261 | $val[0] = '(NOT (' . $val[0] . '))'; |
| 262 | } | 262 | } |
| 263 | } | 263 | } |
| 264 | - | 264 | + |
| 265 | return $val; | 265 | return $val; |
| 266 | } | 266 | } |
| 267 | 267 | ||
| @@ -276,7 +276,7 @@ class NameCriterion extends BrowseCriterion { | @@ -276,7 +276,7 @@ class NameCriterion extends BrowseCriterion { | ||
| 276 | var $bString = true; | 276 | var $bString = true; |
| 277 | var $sSearchTable = "DC"; | 277 | var $sSearchTable = "DC"; |
| 278 | var $bContains = true; | 278 | var $bContains = true; |
| 279 | - | 279 | + |
| 280 | var $sDocumentField = 'filename'; | 280 | var $sDocumentField = 'filename'; |
| 281 | var $sSortField = 'filename'; | 281 | var $sSortField = 'filename'; |
| 282 | var $sNamespace = 'ktcore.criteria.name'; | 282 | var $sNamespace = 'ktcore.criteria.name'; |
| @@ -343,7 +343,7 @@ class TitleCriterion extends BrowseCriterion { | @@ -343,7 +343,7 @@ class TitleCriterion extends BrowseCriterion { | ||
| 343 | function TitleCriterion() { | 343 | function TitleCriterion() { |
| 344 | $this->sDisplay = _kt('Document Title'); | 344 | $this->sDisplay = _kt('Document Title'); |
| 345 | } | 345 | } |
| 346 | - | 346 | + |
| 347 | function documentDisplay ($oDocument) { | 347 | function documentDisplay ($oDocument) { |
| 348 | return $oDocument->getName(); | 348 | return $oDocument->getName(); |
| 349 | } | 349 | } |
| @@ -370,7 +370,7 @@ class CreatorCriterion extends BrowseCriterion { | @@ -370,7 +370,7 @@ class CreatorCriterion extends BrowseCriterion { | ||
| 370 | function CreatorCriterion() { | 370 | function CreatorCriterion() { |
| 371 | $this->sDisplay = _kt('Creator'); | 371 | $this->sDisplay = _kt('Creator'); |
| 372 | } | 372 | } |
| 373 | - | 373 | + |
| 374 | function documentDisplay ($oDocument) { | 374 | function documentDisplay ($oDocument) { |
| 375 | $oCreator = User::get($oDocument->getCreatorID()); | 375 | $oCreator = User::get($oDocument->getCreatorID()); |
| 376 | if ($oCreator) { | 376 | if ($oCreator) { |
| @@ -388,7 +388,7 @@ class CreatorCriterion extends BrowseCriterion { | @@ -388,7 +388,7 @@ class CreatorCriterion extends BrowseCriterion { | ||
| 388 | $oUser =& User::get($aData[$this->getWidgetBase()]); | 388 | $oUser =& User::get($aData[$this->getWidgetBase()]); |
| 389 | if(PEAR::isError($oUser)) { | 389 | if(PEAR::isError($oUser)) { |
| 390 | return $sBase . 'unknown user'; | 390 | return $sBase . 'unknown user'; |
| 391 | - } | 391 | + } |
| 392 | return $sBase . $oUser->getName(); | 392 | return $sBase . $oUser->getName(); |
| 393 | } | 393 | } |
| 394 | 394 | ||
| @@ -434,7 +434,7 @@ class DateCreatedCriterion extends BrowseCriterion { | @@ -434,7 +434,7 @@ class DateCreatedCriterion extends BrowseCriterion { | ||
| 434 | 434 | ||
| 435 | if($sStart) { | 435 | if($sStart) { |
| 436 | $sDisp .= _kt('after ') .$sStart; | 436 | $sDisp .= _kt('after ') .$sStart; |
| 437 | - } | 437 | + } |
| 438 | if($sStart && $sEnd) { | 438 | if($sStart && $sEnd) { |
| 439 | $sDisp .= _kt(' and '); | 439 | $sDisp .= _kt(' and '); |
| 440 | } | 440 | } |
| @@ -449,9 +449,9 @@ class DateCreatedCriterion extends BrowseCriterion { | @@ -449,9 +449,9 @@ class DateCreatedCriterion extends BrowseCriterion { | ||
| 449 | } | 449 | } |
| 450 | function searchWidget ($aRequest, $aPreValue = null) { | 450 | function searchWidget ($aRequest, $aPreValue = null) { |
| 451 | global $default; | 451 | global $default; |
| 452 | - | 452 | + |
| 453 | // IMPORTANT: this requires the presence of kt3-calendar.js | 453 | // IMPORTANT: this requires the presence of kt3-calendar.js |
| 454 | - | 454 | + |
| 455 | $sStartWidget = $this->getWidgetBase() . "_start"; | 455 | $sStartWidget = $this->getWidgetBase() . "_start"; |
| 456 | $sEndWidget = $this->getWidgetBase() . "_end"; | 456 | $sEndWidget = $this->getWidgetBase() . "_end"; |
| 457 | /* // legacy code. | 457 | /* // legacy code. |
| @@ -480,8 +480,8 @@ class DateCreatedCriterion extends BrowseCriterion { | @@ -480,8 +480,8 @@ class DateCreatedCriterion extends BrowseCriterion { | ||
| 480 | } else { | 480 | } else { |
| 481 | $sEnd = $aRequest[$this->getWidgetBase() . "_end"]; | 481 | $sEnd = $aRequest[$this->getWidgetBase() . "_end"]; |
| 482 | } | 482 | } |
| 483 | - | ||
| 484 | - | 483 | + |
| 484 | + | ||
| 485 | $val = null; | 485 | $val = null; |
| 486 | if ($sStart && $sEnd) { | 486 | if ($sStart && $sEnd) { |
| 487 | $val = array($this->getSearchTable() . "." . $this->getSearchField() . " BETWEEN ? AND ?", array($sStart, $sEnd)); | 487 | $val = array($this->getSearchTable() . "." . $this->getSearchField() . " BETWEEN ? AND ?", array($sStart, $sEnd)); |
| @@ -491,17 +491,17 @@ class DateCreatedCriterion extends BrowseCriterion { | @@ -491,17 +491,17 @@ class DateCreatedCriterion extends BrowseCriterion { | ||
| 491 | $val = array($this->getSearchTable() . "." . $this->getSearchField() . " < ?", array($sEnd)); | 491 | $val = array($this->getSearchTable() . "." . $this->getSearchField() . " < ?", array($sEnd)); |
| 492 | } else { | 492 | } else { |
| 493 | return null; | 493 | return null; |
| 494 | - } | ||
| 495 | - | 494 | + } |
| 495 | + | ||
| 496 | // handle the boolean "not" stuff. | 496 | // handle the boolean "not" stuff. |
| 497 | $want_invert = KTUtil::arrayGet($aRequest, $this->getWidgetBase() . '_not'); | 497 | $want_invert = KTUtil::arrayGet($aRequest, $this->getWidgetBase() . '_not'); |
| 498 | - | 498 | + |
| 499 | if (is_null($want_invert) || ($want_invert == "0")) { | 499 | if (is_null($want_invert) || ($want_invert == "0")) { |
| 500 | return $val; | 500 | return $val; |
| 501 | } else { | 501 | } else { |
| 502 | $val[0] = '(NOT (' . $val[0] . '))'; | 502 | $val[0] = '(NOT (' . $val[0] . '))'; |
| 503 | } | 503 | } |
| 504 | - | 504 | + |
| 505 | // finally | 505 | // finally |
| 506 | return $val; | 506 | return $val; |
| 507 | } | 507 | } |
| @@ -636,15 +636,15 @@ class GenericMetadataCriterion extends BrowseCriterion { | @@ -636,15 +636,15 @@ class GenericMetadataCriterion extends BrowseCriterion { | ||
| 636 | $p = parent::searchSQL($aRequest, false); // handle not ourselves. | 636 | $p = parent::searchSQL($aRequest, false); // handle not ourselves. |
| 637 | $p[0] = join(' AND ', array($p[0], "$this->sSearchTable.document_field_id = ?")); | 637 | $p[0] = join(' AND ', array($p[0], "$this->sSearchTable.document_field_id = ?")); |
| 638 | $p[1] = array_merge($p[1], array($this->iID)); | 638 | $p[1] = array_merge($p[1], array($this->iID)); |
| 639 | - | 639 | + |
| 640 | // handle the boolean "not" stuff. | 640 | // handle the boolean "not" stuff. |
| 641 | $want_invert = KTUtil::arrayGet($aRequest, $this->getWidgetBase() . '_not'); | 641 | $want_invert = KTUtil::arrayGet($aRequest, $this->getWidgetBase() . '_not'); |
| 642 | if (is_null($want_invert) || ($want_invert == "0")) { | 642 | if (is_null($want_invert) || ($want_invert == "0")) { |
| 643 | return $p; | 643 | return $p; |
| 644 | } else { | 644 | } else { |
| 645 | $p[0] = '(NOT (' . $p[0] . '))'; | 645 | $p[0] = '(NOT (' . $p[0] . '))'; |
| 646 | - } | ||
| 647 | - | 646 | + } |
| 647 | + | ||
| 648 | return $p; | 648 | return $p; |
| 649 | } | 649 | } |
| 650 | 650 | ||
| @@ -671,9 +671,9 @@ class GeneralMetadataCriterion extends BrowseCriterion { | @@ -671,9 +671,9 @@ class GeneralMetadataCriterion extends BrowseCriterion { | ||
| 671 | { | 671 | { |
| 672 | $this->sDisplay = _kt('General Metadata'); | 672 | $this->sDisplay = _kt('General Metadata'); |
| 673 | } | 673 | } |
| 674 | - | 674 | + |
| 675 | function documentDisplay ($oDocument) { | 675 | function documentDisplay ($oDocument) { |
| 676 | - | 676 | + |
| 677 | return 'General Metadata'; | 677 | return 'General Metadata'; |
| 678 | } | 678 | } |
| 679 | 679 | ||
| @@ -682,11 +682,11 @@ class GeneralMetadataCriterion extends BrowseCriterion { | @@ -682,11 +682,11 @@ class GeneralMetadataCriterion extends BrowseCriterion { | ||
| 682 | return $this->aLookup['field']; | 682 | return $this->aLookup['field']; |
| 683 | } | 683 | } |
| 684 | 684 | ||
| 685 | - | 685 | + |
| 686 | function searchSQL ($aRequest) { | 686 | function searchSQL ($aRequest) { |
| 687 | - $val = array('('.$this->getSearchTable() . "." . $this->getSearchField() . " LIKE '%!%' OR DM.name LIKE '%!%' )", | ||
| 688 | - array(DBUtil::escapeSimple($aRequest[$this->getWidgetBase()]),DBUtil::escapeSimple($aRequest[$this->getWidgetBase()]))); | ||
| 689 | - | 687 | + $val = array('('.$this->getSearchTable() . "." . $this->getSearchField() . " LIKE '%!%' OR DM.name LIKE '%!%' )", |
| 688 | + array(DBUtil::escapeSimple($aRequest[$this->getWidgetBase()]),DBUtil::escapeSimple($aRequest[$this->getWidgetBase()]))); | ||
| 689 | + | ||
| 690 | return $val; | 690 | return $val; |
| 691 | } | 691 | } |
| 692 | 692 | ||
| @@ -736,7 +736,7 @@ class SizeCriterion extends BrowseCriterion { | @@ -736,7 +736,7 @@ class SizeCriterion extends BrowseCriterion { | ||
| 736 | function SizeCriterion() { | 736 | function SizeCriterion() { |
| 737 | $this->sDisplay = _kt('File Size'); | 737 | $this->sDisplay = _kt('File Size'); |
| 738 | } | 738 | } |
| 739 | - | 739 | + |
| 740 | function documentDisplay ($oDocument) { | 740 | function documentDisplay ($oDocument) { |
| 741 | return $oDocument->getFileSize(); | 741 | return $oDocument->getFileSize(); |
| 742 | } | 742 | } |
| @@ -747,7 +747,7 @@ class SizeCriterion extends BrowseCriterion { | @@ -747,7 +747,7 @@ class SizeCriterion extends BrowseCriterion { | ||
| 747 | 747 | ||
| 748 | function parameterDisplay($aData) { | 748 | function parameterDisplay($aData) { |
| 749 | $sBase = $this->getWidgetBase(); | 749 | $sBase = $this->getWidgetBase(); |
| 750 | - return sprintf("%s %s %s %s", $this->baseParameterDisplay(), $this->aCmps[$aData[$sBase.'_not']], $aData[$sBase.'_num'], $this->aTypes[$aData[$sBase.'_type']]); | 750 | + return sprintf("%s %s %s %s", $this->baseParameterDisplay(), $this->aCmps[$aData[$sBase.'_not']], htmlentities($aData[$sBase.'_num'],ENT_QUOTES,'UTF-8'), $this->aTypes[$aData[$sBase.'_type']]); |
| 751 | } | 751 | } |
| 752 | 752 | ||
| 753 | function searchWidget ($aRequest, $aPreValue = null) { | 753 | function searchWidget ($aRequest, $aPreValue = null) { |
| @@ -763,7 +763,7 @@ class SizeCriterion extends BrowseCriterion { | @@ -763,7 +763,7 @@ class SizeCriterion extends BrowseCriterion { | ||
| 763 | 763 | ||
| 764 | // build number | 764 | // build number |
| 765 | $sNumInput = sprintf('<input type="text" name="%s" value="%s"/>', $sNumWidget, KTUtil::arrayGet($aPreValue, $sNumWidget, '')); | 765 | $sNumInput = sprintf('<input type="text" name="%s" value="%s"/>', $sNumWidget, KTUtil::arrayGet($aPreValue, $sNumWidget, '')); |
| 766 | - | 766 | + |
| 767 | 767 | ||
| 768 | // build type selection widget | 768 | // build type selection widget |
| 769 | $sTypeSelect = '<select name="'.$sTypeWidget.'">'; | 769 | $sTypeSelect = '<select name="'.$sTypeWidget.'">'; |
| @@ -802,8 +802,8 @@ class ContentCriterion extends BrowseCriterion { | @@ -802,8 +802,8 @@ class ContentCriterion extends BrowseCriterion { | ||
| 802 | 802 | ||
| 803 | function ContentCriterion() { | 803 | function ContentCriterion() { |
| 804 | $this->sDisplay = _kt('Document Text'); | 804 | $this->sDisplay = _kt('Document Text'); |
| 805 | - } | ||
| 806 | - | 805 | + } |
| 806 | + | ||
| 807 | function documentDisplay ($oDocument) { | 807 | function documentDisplay ($oDocument) { |
| 808 | return "Document Text"; | 808 | return "Document Text"; |
| 809 | } | 809 | } |
| @@ -812,7 +812,7 @@ class ContentCriterion extends BrowseCriterion { | @@ -812,7 +812,7 @@ class ContentCriterion extends BrowseCriterion { | ||
| 812 | } | 812 | } |
| 813 | function getSearchField () { | 813 | function getSearchField () { |
| 814 | return "document_text"; | 814 | return "document_text"; |
| 815 | - } | 815 | + } |
| 816 | 816 | ||
| 817 | function searchSQL ($aRequest) { | 817 | function searchSQL ($aRequest) { |
| 818 | $oKTConfig =& KTConfig::getSingleton(); | 818 | $oKTConfig =& KTConfig::getSingleton(); |
| @@ -840,8 +840,8 @@ class ContentCriterion extends BrowseCriterion { | @@ -840,8 +840,8 @@ class ContentCriterion extends BrowseCriterion { | ||
| 840 | return $p; | 840 | return $p; |
| 841 | } else { | 841 | } else { |
| 842 | $p[0] = '(NOT (' . $p[0] . '))'; | 842 | $p[0] = '(NOT (' . $p[0] . '))'; |
| 843 | - } | ||
| 844 | - | 843 | + } |
| 844 | + | ||
| 845 | return $p; | 845 | return $p; |
| 846 | } | 846 | } |
| 847 | 847 | ||
| @@ -859,8 +859,8 @@ class WorkflowStateCriterion extends BrowseCriterion { | @@ -859,8 +859,8 @@ class WorkflowStateCriterion extends BrowseCriterion { | ||
| 859 | 859 | ||
| 860 | function WorkflowStateCriterion() { | 860 | function WorkflowStateCriterion() { |
| 861 | $this->sDisplay = _kt('Workflow State'); | 861 | $this->sDisplay = _kt('Workflow State'); |
| 862 | - } | ||
| 863 | - | 862 | + } |
| 863 | + | ||
| 864 | function documentDisplay ($oDocument) { | 864 | function documentDisplay ($oDocument) { |
| 865 | $oState =& KTWorkflowState::getByDocument($oDocument); | 865 | $oState =& KTWorkflowState::getByDocument($oDocument); |
| 866 | if ($oState) { | 866 | if ($oState) { |
| @@ -894,14 +894,14 @@ class WorkflowStateCriterion extends BrowseCriterion { | @@ -894,14 +894,14 @@ class WorkflowStateCriterion extends BrowseCriterion { | ||
| 894 | $p = array(); | 894 | $p = array(); |
| 895 | $p[0] = "DM.workflow_state_id = ?"; | 895 | $p[0] = "DM.workflow_state_id = ?"; |
| 896 | $p[1] = $aRequest[$this->getWidgetBase()]; | 896 | $p[1] = $aRequest[$this->getWidgetBase()]; |
| 897 | - | 897 | + |
| 898 | // handle the boolean "not" stuff. | 898 | // handle the boolean "not" stuff. |
| 899 | $want_invert = KTUtil::arrayGet($aRequest, $this->getWidgetBase() . '_not'); | 899 | $want_invert = KTUtil::arrayGet($aRequest, $this->getWidgetBase() . '_not'); |
| 900 | if (is_null($want_invert) || ($want_invert == "0")) { | 900 | if (is_null($want_invert) || ($want_invert == "0")) { |
| 901 | return $p; | 901 | return $p; |
| 902 | } else { | 902 | } else { |
| 903 | $p[0] = '(NOT (' . $p[0] . '))'; | 903 | $p[0] = '(NOT (' . $p[0] . '))'; |
| 904 | - } | 904 | + } |
| 905 | return $p; | 905 | return $p; |
| 906 | } | 906 | } |
| 907 | 907 | ||
| @@ -920,7 +920,7 @@ class WorkflowStateCriterion extends BrowseCriterion { | @@ -920,7 +920,7 @@ class WorkflowStateCriterion extends BrowseCriterion { | ||
| 920 | foreach ($aStates as $oState) { | 920 | foreach ($aStates as $oState) { |
| 921 | $oWorkflow =& KTWorkflow::get($oState->getWorkflowId()); | 921 | $oWorkflow =& KTWorkflow::get($oState->getWorkflowId()); |
| 922 | $sSelStr = ''; | 922 | $sSelStr = ''; |
| 923 | - if ($preval == $oState->getId()) { $sSelStr = ' selected="true"'; } | 923 | + if ($preval == $oState->getId()) { $sSelStr = ' selected="true"'; } |
| 924 | $sRet .= "<option value=\"" . $oState->getId() . "\"" . $sSelStr . ">" . $oWorkflow->getName() . " - " . $oState->getName() . "</option>\n"; | 924 | $sRet .= "<option value=\"" . $oState->getId() . "\"" . $sSelStr . ">" . $oWorkflow->getName() . " - " . $oState->getName() . "</option>\n"; |
| 925 | } | 925 | } |
| 926 | $sRet .= "</select>\n"; | 926 | $sRet .= "</select>\n"; |
| @@ -937,9 +937,9 @@ class DiscussionTextCriterion extends BrowseCriterion { | @@ -937,9 +937,9 @@ class DiscussionTextCriterion extends BrowseCriterion { | ||
| 937 | 937 | ||
| 938 | function DiscussionTextCriterion() { | 938 | function DiscussionTextCriterion() { |
| 939 | $this->sDisplay = _kt('Discussion Threads'); | 939 | $this->sDisplay = _kt('Discussion Threads'); |
| 940 | - } | ||
| 941 | - | ||
| 942 | - | 940 | + } |
| 941 | + | ||
| 942 | + | ||
| 943 | function documentDisplay ($oDocument) { | 943 | function documentDisplay ($oDocument) { |
| 944 | return "Discussion Threads"; | 944 | return "Discussion Threads"; |
| 945 | } | 945 | } |
| @@ -959,15 +959,15 @@ class DiscussionTextCriterion extends BrowseCriterion { | @@ -959,15 +959,15 @@ class DiscussionTextCriterion extends BrowseCriterion { | ||
| 959 | $p = array(); | 959 | $p = array(); |
| 960 | $p[0] = "MATCH(DDCT.body) AGAINST (? $boolean_mode)"; | 960 | $p[0] = "MATCH(DDCT.body) AGAINST (? $boolean_mode)"; |
| 961 | $p[1] = KTUtil::phraseQuote($aRequest[$this->getWidgetBase()]); | 961 | $p[1] = KTUtil::phraseQuote($aRequest[$this->getWidgetBase()]); |
| 962 | - | 962 | + |
| 963 | // handle the boolean "not" stuff. | 963 | // handle the boolean "not" stuff. |
| 964 | $want_invert = KTUtil::arrayGet($aRequest, $this->getWidgetBase() . '_not'); | 964 | $want_invert = KTUtil::arrayGet($aRequest, $this->getWidgetBase() . '_not'); |
| 965 | if (is_null($want_invert) || ($want_invert == "0")) { | 965 | if (is_null($want_invert) || ($want_invert == "0")) { |
| 966 | return $p; | 966 | return $p; |
| 967 | } else { | 967 | } else { |
| 968 | $p[0] = '(NOT (' . $p[0] . '))'; | 968 | $p[0] = '(NOT (' . $p[0] . '))'; |
| 969 | - } | ||
| 970 | - | 969 | + } |
| 970 | + | ||
| 971 | return $p; | 971 | return $p; |
| 972 | } | 972 | } |
| 973 | 973 | ||
| @@ -989,8 +989,8 @@ class SearchableTextCriterion extends BrowseCriterion { | @@ -989,8 +989,8 @@ class SearchableTextCriterion extends BrowseCriterion { | ||
| 989 | 989 | ||
| 990 | function SearchableTextCriterion() { | 990 | function SearchableTextCriterion() { |
| 991 | $this->sDisplay = _kt('Simple Search Text'); | 991 | $this->sDisplay = _kt('Simple Search Text'); |
| 992 | - } | ||
| 993 | - | 992 | + } |
| 993 | + | ||
| 994 | function documentDisplay ($oDocument) { | 994 | function documentDisplay ($oDocument) { |
| 995 | return "Simple search text"; | 995 | return "Simple search text"; |
| 996 | } | 996 | } |
| @@ -1000,7 +1000,7 @@ class SearchableTextCriterion extends BrowseCriterion { | @@ -1000,7 +1000,7 @@ class SearchableTextCriterion extends BrowseCriterion { | ||
| 1000 | 1000 | ||
| 1001 | function getSearchField () { | 1001 | function getSearchField () { |
| 1002 | return "document_text"; | 1002 | return "document_text"; |
| 1003 | - } | 1003 | + } |
| 1004 | 1004 | ||
| 1005 | function searchSQL ($aRequest) { | 1005 | function searchSQL ($aRequest) { |
| 1006 | $oKTConfig =& KTConfig::getSingleton(); | 1006 | $oKTConfig =& KTConfig::getSingleton(); |
| @@ -1015,11 +1015,11 @@ class SearchableTextCriterion extends BrowseCriterion { | @@ -1015,11 +1015,11 @@ class SearchableTextCriterion extends BrowseCriterion { | ||
| 1015 | } else { | 1015 | } else { |
| 1016 | $boolean_mode = ""; | 1016 | $boolean_mode = ""; |
| 1017 | } | 1017 | } |
| 1018 | - | 1018 | + |
| 1019 | $p = array(); | 1019 | $p = array(); |
| 1020 | $temp = str_replace('%', '', $aRequest[$this->getWidgetBase()]); | 1020 | $temp = str_replace('%', '', $aRequest[$this->getWidgetBase()]); |
| 1021 | $keywords = explode(' ', $temp); | 1021 | $keywords = explode(' ', $temp); |
| 1022 | - | 1022 | + |
| 1023 | for($i=0; $i<count($keywords); $i++){ | 1023 | for($i=0; $i<count($keywords); $i++){ |
| 1024 | if($keywords[$i] == ' ' or $keywords[$i] == ''){ | 1024 | if($keywords[$i] == ' ' or $keywords[$i] == ''){ |
| 1025 | continue; | 1025 | continue; |
| @@ -1036,7 +1036,7 @@ class SearchableTextCriterion extends BrowseCriterion { | @@ -1036,7 +1036,7 @@ class SearchableTextCriterion extends BrowseCriterion { | ||
| 1036 | continue; | 1036 | continue; |
| 1037 | } | 1037 | } |
| 1038 | $keywords[$i] = '%'.$keywords[$i].'%'; | 1038 | $keywords[$i] = '%'.$keywords[$i].'%'; |
| 1039 | - } | 1039 | + } |
| 1040 | $p[0] = "DST.document_text LIKE ? AND DST.document_text LIKE ? "; | 1040 | $p[0] = "DST.document_text LIKE ? AND DST.document_text LIKE ? "; |
| 1041 | $p[1] = $keywords; | 1041 | $p[1] = $keywords; |
| 1042 | }else{ | 1042 | }else{ |
| @@ -1050,8 +1050,8 @@ class SearchableTextCriterion extends BrowseCriterion { | @@ -1050,8 +1050,8 @@ class SearchableTextCriterion extends BrowseCriterion { | ||
| 1050 | return $p; | 1050 | return $p; |
| 1051 | } else { | 1051 | } else { |
| 1052 | $p[0] = '(NOT (' . $p[0] . '))'; | 1052 | $p[0] = '(NOT (' . $p[0] . '))'; |
| 1053 | - } | ||
| 1054 | - | 1053 | + } |
| 1054 | + | ||
| 1055 | return $p; | 1055 | return $p; |
| 1056 | } | 1056 | } |
| 1057 | 1057 | ||
| @@ -1071,8 +1071,8 @@ class TransactionTextCriterion extends BrowseCriterion { | @@ -1071,8 +1071,8 @@ class TransactionTextCriterion extends BrowseCriterion { | ||
| 1071 | 1071 | ||
| 1072 | function TransactionTextCriterion() { | 1072 | function TransactionTextCriterion() { |
| 1073 | $this->sDisplay = _kt('Transaction Text'); | 1073 | $this->sDisplay = _kt('Transaction Text'); |
| 1074 | - } | ||
| 1075 | - | 1074 | + } |
| 1075 | + | ||
| 1076 | function documentDisplay ($oDocument) { | 1076 | function documentDisplay ($oDocument) { |
| 1077 | return "Transaction text"; | 1077 | return "Transaction text"; |
| 1078 | } | 1078 | } |
| @@ -1092,15 +1092,15 @@ class TransactionTextCriterion extends BrowseCriterion { | @@ -1092,15 +1092,15 @@ class TransactionTextCriterion extends BrowseCriterion { | ||
| 1092 | $p = array(); | 1092 | $p = array(); |
| 1093 | $p[0] = "MATCH(DTT.document_text) AGAINST (? $boolean_mode)"; | 1093 | $p[0] = "MATCH(DTT.document_text) AGAINST (? $boolean_mode)"; |
| 1094 | $p[1] = KTUtil::phraseQuote($aRequest[$this->getWidgetBase()]); | 1094 | $p[1] = KTUtil::phraseQuote($aRequest[$this->getWidgetBase()]); |
| 1095 | - | 1095 | + |
| 1096 | // handle the boolean "not" stuff. | 1096 | // handle the boolean "not" stuff. |
| 1097 | $want_invert = KTUtil::arrayGet($aRequest, $this->getWidgetBase() . '_not'); | 1097 | $want_invert = KTUtil::arrayGet($aRequest, $this->getWidgetBase() . '_not'); |
| 1098 | if (is_null($want_invert) || ($want_invert == "0")) { | 1098 | if (is_null($want_invert) || ($want_invert == "0")) { |
| 1099 | return $p; | 1099 | return $p; |
| 1100 | } else { | 1100 | } else { |
| 1101 | $p[0] = '(NOT (' . $p[0] . '))'; | 1101 | $p[0] = '(NOT (' . $p[0] . '))'; |
| 1102 | - } | ||
| 1103 | - | 1102 | + } |
| 1103 | + | ||
| 1104 | return $p; | 1104 | return $p; |
| 1105 | } | 1105 | } |
| 1106 | 1106 | ||
| @@ -1118,11 +1118,11 @@ class TagCloudCriterion extends BrowseCriterion { | @@ -1118,11 +1118,11 @@ class TagCloudCriterion extends BrowseCriterion { | ||
| 1118 | var $sSortField = 'tag'; | 1118 | var $sSortField = 'tag'; |
| 1119 | var $sNamespace = 'ktcore.criteria.tagcloud'; | 1119 | var $sNamespace = 'ktcore.criteria.tagcloud'; |
| 1120 | var $sSearchTable = "TWS" ; | 1120 | var $sSearchTable = "TWS" ; |
| 1121 | - | 1121 | + |
| 1122 | function TagCloudCriterion() { | 1122 | function TagCloudCriterion() { |
| 1123 | $this->sDisplay = _kt('Tag Cloud'); | 1123 | $this->sDisplay = _kt('Tag Cloud'); |
| 1124 | - } | ||
| 1125 | - | 1124 | + } |
| 1125 | + | ||
| 1126 | function documentDisplay ($oDocument) { | 1126 | function documentDisplay ($oDocument) { |
| 1127 | return "Tag Cloud"; | 1127 | return "Tag Cloud"; |
| 1128 | } | 1128 | } |
| @@ -1132,16 +1132,16 @@ class TagCloudCriterion extends BrowseCriterion { | @@ -1132,16 +1132,16 @@ class TagCloudCriterion extends BrowseCriterion { | ||
| 1132 | 1132 | ||
| 1133 | function searchSQL ($aRequest) { | 1133 | function searchSQL ($aRequest) { |
| 1134 | $p = parent::searchSQL($aRequest, false); // handle not ourselves. | 1134 | $p = parent::searchSQL($aRequest, false); // handle not ourselves. |
| 1135 | - | 1135 | + |
| 1136 | // handle the boolean "not" stuff. | 1136 | // handle the boolean "not" stuff. |
| 1137 | $want_invert = KTUtil::arrayGet($aRequest, $this->getWidgetBase() . '_not'); | 1137 | $want_invert = KTUtil::arrayGet($aRequest, $this->getWidgetBase() . '_not'); |
| 1138 | if (is_null($want_invert) || ($want_invert == "0")) { | 1138 | if (is_null($want_invert) || ($want_invert == "0")) { |
| 1139 | return $p; | 1139 | return $p; |
| 1140 | } else { | 1140 | } else { |
| 1141 | $p[0] = '(NOT (' . $p[0] . '))'; | 1141 | $p[0] = '(NOT (' . $p[0] . '))'; |
| 1142 | - } | ||
| 1143 | - | ||
| 1144 | - return $p; | 1142 | + } |
| 1143 | + | ||
| 1144 | + return $p; | ||
| 1145 | } | 1145 | } |
| 1146 | 1146 | ||
| 1147 | function searchJoinSQL () { | 1147 | function searchJoinSQL () { |
| @@ -1163,14 +1163,14 @@ class DateCreatedDeltaCriterion extends DateCreatedCriterion { | @@ -1163,14 +1163,14 @@ class DateCreatedDeltaCriterion extends DateCreatedCriterion { | ||
| 1163 | 1163 | ||
| 1164 | function DateCreatedDeltaCriterion() { | 1164 | function DateCreatedDeltaCriterion() { |
| 1165 | $this->sDisplay = _kt('Date Created Delta'); | 1165 | $this->sDisplay = _kt('Date Created Delta'); |
| 1166 | - } | 1166 | + } |
| 1167 | 1167 | ||
| 1168 | - function parameterDisplay($aData) { | 1168 | + function parameterDisplay($aData) { |
| 1169 | $sNum = KTUtil::arrayGet($aData, $this->getWidgetBase() . '_num'); | 1169 | $sNum = KTUtil::arrayGet($aData, $this->getWidgetBase() . '_num'); |
| 1170 | $sType = KTUtil::arrayGet($aData, $this->getWidgetBase() . '_type'); | 1170 | $sType = KTUtil::arrayGet($aData, $this->getWidgetBase() . '_type'); |
| 1171 | return sprintf('%s %s %s', $this->baseParameterDisplay(), $sNum, $this->aTypes[$sType]); | 1171 | return sprintf('%s %s %s', $this->baseParameterDisplay(), $sNum, $this->aTypes[$sType]); |
| 1172 | } | 1172 | } |
| 1173 | - | 1173 | + |
| 1174 | function searchWidget ($aRequest, $aPreValue = null) { | 1174 | function searchWidget ($aRequest, $aPreValue = null) { |
| 1175 | $sNumWidget = $this->getWidgetBase() . '_num'; | 1175 | $sNumWidget = $this->getWidgetBase() . '_num'; |
| 1176 | $sTypeWidget = $this->getWidgetBase() . '_type'; | 1176 | $sTypeWidget = $this->getWidgetBase() . '_type'; |
| @@ -1196,7 +1196,7 @@ class DateCreatedDeltaCriterion extends DateCreatedCriterion { | @@ -1196,7 +1196,7 @@ class DateCreatedDeltaCriterion extends DateCreatedCriterion { | ||
| 1196 | $sType = KTUtil::arrayGet($aRequest, $this->getWidgetBase() . '_type'); | 1196 | $sType = KTUtil::arrayGet($aRequest, $this->getWidgetBase() . '_type'); |
| 1197 | 1197 | ||
| 1198 | $val = array($this->getSearchTable() . "." . $this->getSearchField() . " > SUBDATE(NOW(), INTERVAL ? {$sType})", array($sNum)); | 1198 | $val = array($this->getSearchTable() . "." . $this->getSearchField() . " > SUBDATE(NOW(), INTERVAL ? {$sType})", array($sNum)); |
| 1199 | - | 1199 | + |
| 1200 | $want_invert = KTUtil::arrayGet($aRequest, $this->getWidgetBase() . '_not'); | 1200 | $want_invert = KTUtil::arrayGet($aRequest, $this->getWidgetBase() . '_not'); |
| 1201 | if (is_null($want_invert) || ($want_invert == "0")) { | 1201 | if (is_null($want_invert) || ($want_invert == "0")) { |
| 1202 | return $val; | 1202 | return $val; |
| @@ -1215,8 +1215,8 @@ class DateModifiedDeltaCriterion extends DateCreatedDeltaCriterion { | @@ -1215,8 +1215,8 @@ class DateModifiedDeltaCriterion extends DateCreatedDeltaCriterion { | ||
| 1215 | 1215 | ||
| 1216 | function DateModifiedDeltaCriterion() { | 1216 | function DateModifiedDeltaCriterion() { |
| 1217 | $this->sDisplay = _kt('Date Modified Delta'); | 1217 | $this->sDisplay = _kt('Date Modified Delta'); |
| 1218 | - } | ||
| 1219 | - | 1218 | + } |
| 1219 | + | ||
| 1220 | function documentDisplay ($oDocument) { | 1220 | function documentDisplay ($oDocument) { |
| 1221 | return $oDocument->getLastModifiedDate(); | 1221 | return $oDocument->getLastModifiedDate(); |
| 1222 | } | 1222 | } |