Commit 94662b4a39a860f595e672a98ec2f146b99270d8

Authored by kevin_fourie
1 parent cb5c72c3

Merged in from DEV trunk...

KTC-399
"Bulk checkout: when you checkout an already checked out document you get an information alert that is not clear"
Fixed. If a document is checked out by the current user it now gets added to the downloaded files.

Committed by: Megan Watson
Reviewed by: Jonathan Byrne

KTS-2655
"Error Message On Removing Permissions but action goes ahead anyway"
Fixed. Added a check to ensure the user doesn't removed his/her own permission to manage security.

Committed by: Megan Watson
Reviewed by: Jonathan Byrne

KTS-2873
"Double quote (") is not accepted as valid input for metadata when the name of a Lookup field or a Tree field has a Double quote in."
Fixed. The values in the sub categories needed to be htmlentities().

Committed by: Megan Watson
Reviewed by: Jonathan Byrne

KTS-3091
"The name of the open office service needs to be changed in the script to check if its running"
Fixed. Changed the name and the paths to match the new stack.

Committed by: Megan Watson
Reviewed by: Jonathan Byrne

KTS-3093
"Creating fieldsets and fields with quotes results in double escaping of names and descriptions"
Fixed.

Committed By: Conrad Vermeulen
Reviewed By: Megan Watson

KTS-3096
"Creating workflow, workflow states, workflow transition names with quotes results in double escaping of names and descriptions"
Fixed.

Committed By: Conrad Vermeulen
Reviewed By: Megan Watson

KTS-3097
"Field names with quotes was impacting on search2 query builder"
Fixed.

Committed By: Conrad Vermeulen
Reviewed By: Megan Watson

KTS-3085
"Storage utilisation plugin does not seem to be working on Windows Vista."
Fixed. Unfortunately, df does not work on Vista. We now detect if df has a problem and disable the dashlet accordingly.

Committed By: Conrad Vermeulen
Reviewed By: Megan Watson

KTC-403
"One is able to make a checked out document immutable"

Fixed. Added a check to return an error if the document is checked out.

Committed By: Jonathan Byrne
Reviewed By: Megan Watson

KTS-1888
"Expunge page in the DMS Administration section, pagination not working, links to consecutive pages do not work"

Fixed. Changed the php file to return the contents of a div and not just a table body so that pagination works in Internet Explorer.

Committed By: Jonathan Byrne
Reviewed By: Jalaloedien Abrahams


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@8171 c91229c3-7414-0410-bfa2-8a42b809f60b
bin/checkopenoffice.php
@@ -42,24 +42,23 @@ require_once('../config/dmsDefaults.php'); @@ -42,24 +42,23 @@ require_once('../config/dmsDefaults.php');
42 // Check if open office is running 42 // Check if open office is running
43 $sCheckOO = SearchHelper::checkOpenOfficeAvailablity(); 43 $sCheckOO = SearchHelper::checkOpenOfficeAvailablity();
44 44
45 -  
46 // If it is running - exit, we don't need to do anything otherwise start it 45 // If it is running - exit, we don't need to do anything otherwise start it
47 if(!empty($sCheckOO)){ 46 if(!empty($sCheckOO)){
48 - 47 +
49 $default->log->debug('Check Open Office Task: Open office service is not running... trying to start it.'); 48 $default->log->debug('Check Open Office Task: Open office service is not running... trying to start it.');
50 - 49 +
51 if(OS_WINDOWS){ 50 if(OS_WINDOWS){
52 - 51 +
53 // Check the path first 52 // Check the path first
54 - $sPath = realpath('../../winserv.exe'); 53 + $sPath = realpath('../../bin/winserv.exe');
55 54
56 if(file_exists($sPath)){ 55 if(file_exists($sPath)){
57 - $sCmd = "\"$sPath\" start kt_openoffice"; 56 + $sCmd = "\"$sPath\" start ktopenoffice";
58 KTUtil::pexec($sCmd); 57 KTUtil::pexec($sCmd);
59 exit; 58 exit;
60 } 59 }
61 // If that doesn't work, check for the all start 60 // If that doesn't work, check for the all start
62 - $sPath = realpath('../../bin/allctl.bat'); 61 + $sPath = realpath('../../bin/dmsctl.bat');
63 if(file_exists($sPath)){ 62 if(file_exists($sPath)){
64 $sCmd = "\"$sPath\" start"; 63 $sCmd = "\"$sPath\" start";
65 KTUtil::pexec($sCmd); 64 KTUtil::pexec($sCmd);
lib/documentmanagement/DocumentField.inc
@@ -7,32 +7,32 @@ @@ -7,32 +7,32 @@
7 * KnowledgeTree Open Source Edition 7 * KnowledgeTree Open Source Edition
8 * Document Management Made Simple 8 * Document Management Made Simple
9 * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited 9 * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
10 - * 10 + *
11 * This program is free software; you can redistribute it and/or modify it under 11 * This program is free software; you can redistribute it and/or modify it under
12 * the terms of the GNU General Public License version 3 as published by the 12 * the terms of the GNU General Public License version 3 as published by the
13 * Free Software Foundation. 13 * Free Software Foundation.
14 - * 14 + *
15 * This program is distributed in the hope that it will be useful, but WITHOUT 15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 * details. 18 * details.
19 - * 19 + *
20 * You should have received a copy of the GNU General Public License 20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>. 21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 - * 22 + *
23 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, 23 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
24 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. 24 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
25 - * 25 + *
26 * The interactive user interfaces in modified source and object code versions 26 * The interactive user interfaces in modified source and object code versions
27 * of this program must display Appropriate Legal Notices, as required under 27 * of this program must display Appropriate Legal Notices, as required under
28 * Section 5 of the GNU General Public License version 3. 28 * Section 5 of the GNU General Public License version 3.
29 - * 29 + *
30 * In accordance with Section 7(b) of the GNU General Public License version 3, 30 * In accordance with Section 7(b) of the GNU General Public License version 3,
31 * these Appropriate Legal Notices must retain the display of the "Powered by 31 * these Appropriate Legal Notices must retain the display of the "Powered by
32 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the 32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
33 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 33 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
34 - * must display the words "Powered by KnowledgeTree" and retain the original  
35 - * copyright notice. 34 + * must display the words "Powered by KnowledgeTree" and retain the original
  35 + * copyright notice.
36 * Contributor( s): ______________________________________ 36 * Contributor( s): ______________________________________
37 */ 37 */
38 38
@@ -79,10 +79,10 @@ class DocumentField extends KTEntity { @@ -79,10 +79,10 @@ class DocumentField extends KTEntity {
79 } 79 }
80 80
81 function getID() { return $this->iId; } 81 function getID() { return $this->iId; }
82 - function getName() { return sanitizeForSQLtoHTML($this->sName); }  
83 - function setName($sNewValue) { $this->sName = sanitizeForSQL($sNewValue); }  
84 - function setDescription($sNewValue) { $this->sDescription = sanitizeForSQL($sNewValue); }  
85 - function getDescription() { return sanitizeForSQLtoHTML($this->sDescription); } 82 + function getName() { return $this->sName; }
  83 + function setName($sNewValue) { $this->sName = $sNewValue; }
  84 + function setDescription($sNewValue) { $this->sDescription = $sNewValue; }
  85 + function getDescription() { return $this->sDescription; }
86 function getDataType() { return $this->sDataType; } 86 function getDataType() { return $this->sDataType; }
87 function setDataType($sNewValue) { $this->sDataType = $sNewValue; } 87 function setDataType($sNewValue) { $this->sDataType = $sNewValue; }
88 function getIsGeneric() { return $this->bIsGeneric; } 88 function getIsGeneric() { return $this->bIsGeneric; }
lib/documentmanagement/MDTree.inc
@@ -289,7 +289,7 @@ class MDTree { @@ -289,7 +289,7 @@ class MDTree {
289 $extraclass = ' inactive'; 289 $extraclass = ' inactive';
290 } 290 }
291 291
292 - $treeStr .= '<li class="treenode' . $extraclass . '"><a class="pathnode" onclick="toggleElementClass(\'active\', this.parentNode);toggleElementClass(\'inactive\', this.parentNode);">' . $treeToRender->mapnodes[$subnode_val]->getName() . '</a>'; 292 + $treeStr .= '<li class="treenode' . $extraclass . '"><a class="pathnode" onclick="toggleElementClass(\'active\', this.parentNode);toggleElementClass(\'inactive\', this.parentNode);">' . htmlentities($treeToRender->mapnodes[$subnode_val]->getName()) . '</a>';
293 $treeStr .= $this->_evilTreeRecursion($subnode_val, $treeToRender, $inputname); 293 $treeStr .= $this->_evilTreeRecursion($subnode_val, $treeToRender, $inputname);
294 $treeStr .= '</li>'; 294 $treeStr .= '</li>';
295 } 295 }
@@ -301,7 +301,8 @@ class MDTree { @@ -301,7 +301,8 @@ class MDTree {
301 if ($leaf === $this->activevalue) { 301 if ($leaf === $this->activevalue) {
302 $is_selected=' checked="checked"'; 302 $is_selected=' checked="checked"';
303 } 303 }
304 - $treeStr .= '<li class="leafnode"><input type="radio" name="'.$inputname.'" value="'.$treeToRender->lookups[$leaf]->getName().'" '.$is_selected.'>' . $treeToRender->lookups[$leaf]->getName() .'</input>'; 304 + $sValue = htmlentities($treeToRender->lookups[$leaf]->getName());
  305 + $treeStr .= '<li class="leafnode"><input type="radio" name="'.$inputname.'" value="'.$sValue.'" '.$is_selected.'>' . $sValue .'</input>';
305 $treeStr .= '</li>'; } 306 $treeStr .= '</li>'; }
306 } 307 }
307 } 308 }
lib/groups/GroupUtil.php
@@ -7,32 +7,32 @@ @@ -7,32 +7,32 @@
7 * KnowledgeTree Open Source Edition 7 * KnowledgeTree Open Source Edition
8 * Document Management Made Simple 8 * Document Management Made Simple
9 * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited 9 * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
10 - * 10 + *
11 * This program is free software; you can redistribute it and/or modify it under 11 * This program is free software; you can redistribute it and/or modify it under
12 * the terms of the GNU General Public License version 3 as published by the 12 * the terms of the GNU General Public License version 3 as published by the
13 * Free Software Foundation. 13 * Free Software Foundation.
14 - * 14 + *
15 * This program is distributed in the hope that it will be useful, but WITHOUT 15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 * details. 18 * details.
19 - * 19 + *
20 * You should have received a copy of the GNU General Public License 20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>. 21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 - * 22 + *
23 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, 23 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
24 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. 24 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
25 - * 25 + *
26 * The interactive user interfaces in modified source and object code versions 26 * The interactive user interfaces in modified source and object code versions
27 * of this program must display Appropriate Legal Notices, as required under 27 * of this program must display Appropriate Legal Notices, as required under
28 * Section 5 of the GNU General Public License version 3. 28 * Section 5 of the GNU General Public License version 3.
29 - * 29 + *
30 * In accordance with Section 7(b) of the GNU General Public License version 3, 30 * In accordance with Section 7(b) of the GNU General Public License version 3,
31 * these Appropriate Legal Notices must retain the display of the "Powered by 31 * these Appropriate Legal Notices must retain the display of the "Powered by
32 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the 32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
33 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 33 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
34 - * must display the words "Powered by KnowledgeTree" and retain the original  
35 - * copyright notice. 34 + * must display the words "Powered by KnowledgeTree" and retain the original
  35 + * copyright notice.
36 * Contributor( s): ______________________________________ 36 * Contributor( s): ______________________________________
37 */ 37 */
38 38
@@ -304,6 +304,26 @@ class GroupUtil { @@ -304,6 +304,26 @@ class GroupUtil {
304 } 304 }
305 // }}} 305 // }}}
306 306
  307 + function checkUserInGroups($iUserId, $aGroupIds) {
  308 + $sGroupIds = implode(', ', $aGroupIds);
  309 +
  310 + global $default;
  311 + $sTable = $default->users_groups_table;
  312 + $sQuery = "SELECT count(*) AS cnt FROM $sTable WHERE user_id = ? AND group_id IN (?)";
  313 + $aParams = array($iUserId, $sGroupIds);
  314 +
  315 + $res = DBUtil::getOneResult(array($sQuery, $aParams));
  316 +
  317 + if(PEAR::isError($res) || empty($res)){
  318 + return false;
  319 + }
  320 +
  321 + if($res['cnt'] > 0){
  322 + return true;
  323 + }
  324 + return false;
  325 + }
  326 +
307 // {{{ 327 // {{{
308 function buildGroupArray() { 328 function buildGroupArray() {
309 global $default; 329 global $default;
lib/metadata/fieldset.inc.php
@@ -5,32 +5,32 @@ @@ -5,32 +5,32 @@
5 * KnowledgeTree Open Source Edition 5 * KnowledgeTree Open Source Edition
6 * Document Management Made Simple 6 * Document Management Made Simple
7 * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited 7 * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
8 - * 8 + *
9 * This program is free software; you can redistribute it and/or modify it under 9 * This program is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License version 3 as published by the 10 * the terms of the GNU General Public License version 3 as published by the
11 * Free Software Foundation. 11 * Free Software Foundation.
12 - * 12 + *
13 * This program is distributed in the hope that it will be useful, but WITHOUT 13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 * details. 16 * details.
17 - * 17 + *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 - * 20 + *
21 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, 21 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
22 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. 22 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
23 - * 23 + *
24 * The interactive user interfaces in modified source and object code versions 24 * The interactive user interfaces in modified source and object code versions
25 * of this program must display Appropriate Legal Notices, as required under 25 * of this program must display Appropriate Legal Notices, as required under
26 * Section 5 of the GNU General Public License version 3. 26 * Section 5 of the GNU General Public License version 3.
27 - * 27 + *
28 * In accordance with Section 7(b) of the GNU General Public License version 3, 28 * In accordance with Section 7(b) of the GNU General Public License version 3,
29 * these Appropriate Legal Notices must retain the display of the "Powered by 29 * these Appropriate Legal Notices must retain the display of the "Powered by
30 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the 30 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
31 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 31 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
32 - * must display the words "Powered by KnowledgeTree" and retain the original  
33 - * copyright notice. 32 + * must display the words "Powered by KnowledgeTree" and retain the original
  33 + * copyright notice.
34 * Contributor( s): ______________________________________ 34 * Contributor( s): ______________________________________
35 * 35 *
36 */ 36 */
@@ -45,7 +45,7 @@ require_once(KT_LIB_DIR . &quot;/util/sanitize.inc&quot;); @@ -45,7 +45,7 @@ require_once(KT_LIB_DIR . &quot;/util/sanitize.inc&quot;);
45 * Represents the basic grouping of fields into a fieldset. 45 * Represents the basic grouping of fields into a fieldset.
46 */ 46 */
47 class KTFieldset extends KTEntity { 47 class KTFieldset extends KTEntity {
48 - 48 +
49 /** primary key value */ 49 /** primary key value */
50 var $iId = -1; 50 var $iId = -1;
51 /** document fieldset name */ 51 /** document fieldset name */
@@ -54,7 +54,7 @@ class KTFieldset extends KTEntity { @@ -54,7 +54,7 @@ class KTFieldset extends KTEntity {
54 var $sDescription; 54 var $sDescription;
55 /** document fieldset namespace */ 55 /** document fieldset namespace */
56 var $sNamespace; 56 var $sNamespace;
57 - 57 +
58 /** document fieldset mandatory flag */ 58 /** document fieldset mandatory flag */
59 var $bMandatory = false; 59 var $bMandatory = false;
60 var $iMasterFieldId; 60 var $iMasterFieldId;
@@ -70,30 +70,30 @@ class KTFieldset extends KTEntity { @@ -70,30 +70,30 @@ class KTFieldset extends KTEntity {
70 * is used only by the document management system. 70 * is used only by the document management system.
71 */ 71 */
72 var $bIsSystem = false; 72 var $bIsSystem = false;
73 - 73 +
74 var $_bUsePearError = true; 74 var $_bUsePearError = true;
75 - 75 +
76 function getId() { return $this->iId; } 76 function getId() { return $this->iId; }
77 - function getName() { return sanitizeForSQLtoHTML($this->sName); }  
78 - function setDescription($sNewValue) { $this->sDescription = sanitizeForSQL($sNewValue); }  
79 - function getDescription() { return sanitizeForSQLtoHTML($this->sDescription); }  
80 - function setName($sNewValue) { $this->sName = sanitizeForSQL($sNewValue); } 77 + function getName() { return $this->sName; }
  78 + function setDescription($sNewValue) { $this->sDescription = $sNewValue; }
  79 + function getDescription() { return $this->sDescription; }
  80 + function setName($sNewValue) { $this->sName = $sNewValue; }
81 function getNamespace() { return $this->sNamespace; } 81 function getNamespace() { return $this->sNamespace; }
82 function setNamespace($sNewValue) { $this->sNamespace = $sNewValue; } 82 function setNamespace($sNewValue) { $this->sNamespace = $sNewValue; }
83 function getMandatory() { return $this->bMandatory; } 83 function getMandatory() { return $this->bMandatory; }
84 - function setMandatory($bNewValue) { $this->bMandatory = $bNewValue; } 84 + function setMandatory($bNewValue) { $this->bMandatory = $bNewValue; }
85 function getIsConditional () { return $this->bIsConditional; } 85 function getIsConditional () { return $this->bIsConditional; }
86 - function setIsConditional ($bNewValue) { $this->bIsConditional = $bNewValue; } 86 + function setIsConditional ($bNewValue) { $this->bIsConditional = $bNewValue; }
87 function getMasterFieldId () { return $this->iMasterFieldId; } 87 function getMasterFieldId () { return $this->iMasterFieldId; }
88 - function setMasterFieldId ($iNewValue) { $this->iMasterFieldId = $iNewValue; } 88 + function setMasterFieldId ($iNewValue) { $this->iMasterFieldId = $iNewValue; }
89 function getIsGeneric () { return $this->bIsGeneric; } 89 function getIsGeneric () { return $this->bIsGeneric; }
90 - function setIsGeneric ($bNewValue) { $this->bIsGeneric = $bNewValue; } 90 + function setIsGeneric ($bNewValue) { $this->bIsGeneric = $bNewValue; }
91 function getIsComplete () { return $this->bIsComplete; } 91 function getIsComplete () { return $this->bIsComplete; }
92 - function setIsComplete ($bNewValue) { $this->bIsComplete = $bNewValue; } 92 + function setIsComplete ($bNewValue) { $this->bIsComplete = $bNewValue; }
93 function getIsComplex () { return $this->bIsComplex; } 93 function getIsComplex () { return $this->bIsComplex; }
94 - function setIsComplex ($bNewValue) { $this->bIsComplex = $bNewValue; } 94 + function setIsComplex ($bNewValue) { $this->bIsComplex = $bNewValue; }
95 function getIsSystem () { return $this->bIsSystem; } 95 function getIsSystem () { return $this->bIsSystem; }
96 - function setIsSystem ($bNewValue) { $this->bIsSystem = $bNewValue; } 96 + function setIsSystem ($bNewValue) { $this->bIsSystem = $bNewValue; }
97 97
98 var $_aFieldToSelect = array( 98 var $_aFieldToSelect = array(
99 "iId" => "id", 99 "iId" => "id",
@@ -108,17 +108,17 @@ class KTFieldset extends KTEntity { @@ -108,17 +108,17 @@ class KTFieldset extends KTEntity {
108 "bIsComplex" => "is_complex", 108 "bIsComplex" => "is_complex",
109 "bIsSystem" => "is_system", 109 "bIsSystem" => "is_system",
110 ); 110 );
111 - 111 +
112 // returns TRUE if all children are lookup enabled, false otherwise. 112 // returns TRUE if all children are lookup enabled, false otherwise.
113 function canBeMadeConditional() { 113 function canBeMadeConditional() {
114 if ($this->getIsConditional()) { 114 if ($this->getIsConditional()) {
115 return false; 115 return false;
116 } 116 }
117 - 117 +
118 // DEBUG 118 // DEBUG
119 return false; 119 return false;
120 } 120 }
121 - 121 +
122 function _table () { 122 function _table () {
123 return KTUtil::getTableName('fieldsets'); 123 return KTUtil::getTableName('fieldsets');
124 } 124 }
@@ -127,13 +127,13 @@ class KTFieldset extends KTEntity { @@ -127,13 +127,13 @@ class KTFieldset extends KTEntity {
127 127
128 128
129 129
130 - /* 130 + /*
131 * get document types using this field 131 * get document types using this field
132 - * for listing displays 132 + * for listing displays
133 */ 133 */
134 function &getDocumentTypesUsing($aOptions = null) { 134 function &getDocumentTypesUsing($aOptions = null) {
135 $bIds = KTUtil::arrayGet($aOptions, 'ids'); 135 $bIds = KTUtil::arrayGet($aOptions, 'ids');
136 - 136 +
137 $sTable = KTUtil::getTableName('document_type_fieldsets'); 137 $sTable = KTUtil::getTableName('document_type_fieldsets');
138 138
139 $aQuery = array( 139 $aQuery = array(
@@ -161,7 +161,7 @@ class KTFieldset extends KTEntity { @@ -161,7 +161,7 @@ class KTFieldset extends KTEntity {
161 161
162 // Static function 162 // Static function
163 function &get($iId) { return KTEntityUtil::get('KTFieldset', $iId); } 163 function &get($iId) { return KTEntityUtil::get('KTFieldset', $iId); }
164 - function &getList($sWhereClause = null) { return KTEntityUtil::getList2('KTFieldset', $sWhereClause); } 164 + function &getList($sWhereClause = null) { return KTEntityUtil::getList2('KTFieldset', $sWhereClause); }
165 function &createFromArray($aOptions) { return KTEntityUtil::createFromArray('KTFieldset', $aOptions); } 165 function &createFromArray($aOptions) { return KTEntityUtil::createFromArray('KTFieldset', $aOptions); }
166 166
167 function &getNonGenericFieldsets($aOptions = null) { 167 function &getNonGenericFieldsets($aOptions = null) {
@@ -172,18 +172,18 @@ class KTFieldset extends KTEntity { @@ -172,18 +172,18 @@ class KTFieldset extends KTEntity {
172 'is_generic' => false, 172 'is_generic' => false,
173 'disabled' => false, 173 'disabled' => false,
174 ), $aOptions); 174 ), $aOptions);
175 - } 175 + }
176 176
177 function &getGenericFieldsets($aOptions = null) { 177 function &getGenericFieldsets($aOptions = null) {
178 $aOptions = KTUtil::meldOptions( 178 $aOptions = KTUtil::meldOptions(
179 - $aOptions, 179 + $aOptions,
180 array('multi' => true,) 180 array('multi' => true,)
181 ); 181 );
182 return KTEntityUtil::getByDict('KTFieldset', array( 182 return KTEntityUtil::getByDict('KTFieldset', array(
183 'is_generic' => true, 183 'is_generic' => true,
184 'disabled' => false, 184 'disabled' => false,
185 ), $aOptions); 185 ), $aOptions);
186 - } 186 + }
187 187
188 function &getForDocumentType($oDocumentType, $aOptions = null) { 188 function &getForDocumentType($oDocumentType, $aOptions = null) {
189 $bIds = KTUtil::arrayGet($aOptions, 'ids'); 189 $bIds = KTUtil::arrayGet($aOptions, 'ids');
@@ -192,7 +192,7 @@ class KTFieldset extends KTEntity { @@ -192,7 +192,7 @@ class KTFieldset extends KTEntity {
192 } else { 192 } else {
193 $iDocumentTypeId = $oDocumentType; 193 $iDocumentTypeId = $oDocumentType;
194 } 194 }
195 - 195 +
196 $sTable = KTUtil::getTableName('document_type_fieldsets'); 196 $sTable = KTUtil::getTableName('document_type_fieldsets');
197 $aQuery = array( 197 $aQuery = array(
198 "SELECT fieldset_id FROM $sTable WHERE document_type_id = ?", 198 "SELECT fieldset_id FROM $sTable WHERE document_type_id = ?",
@@ -210,22 +210,22 @@ class KTFieldset extends KTEntity { @@ -210,22 +210,22 @@ class KTFieldset extends KTEntity {
210 } 210 }
211 return $aRet; 211 return $aRet;
212 } 212 }
213 - 213 +
214 function &getAssociatedTypes() { 214 function &getAssociatedTypes() {
215 // NOTE: this returns null if we are generic (all is the wrong answer) 215 // NOTE: this returns null if we are generic (all is the wrong answer)
216 if ($this->getIsGeneric()) { return array(); } 216 if ($this->getIsGeneric()) { return array(); }
217 - 217 +
218 $sTable = KTUtil::getTableName('document_type_fieldsets'); 218 $sTable = KTUtil::getTableName('document_type_fieldsets');
219 $aQuery = array( 219 $aQuery = array(
220 "SELECT document_type_id FROM $sTable WHERE fieldset_id = ?", 220 "SELECT document_type_id FROM $sTable WHERE fieldset_id = ?",
221 array($this->getId()), 221 array($this->getId()),
222 ); 222 );
223 $aIds = DBUtil::getResultArrayKey($aQuery, 'document_type_id'); 223 $aIds = DBUtil::getResultArrayKey($aQuery, 'document_type_id');
224 - 224 +
225 $aRet = array(); 225 $aRet = array();
226 foreach ($aIds as $iID) { 226 foreach ($aIds as $iID) {
227 $oType = DocumentType::get($iID); 227 $oType = DocumentType::get($iID);
228 - if (!PEAR::isError($oType)) { 228 + if (!PEAR::isError($oType)) {
229 $aRet[] = $oType; 229 $aRet[] = $oType;
230 } 230 }
231 } 231 }
@@ -248,13 +248,13 @@ class KTFieldset extends KTEntity { @@ -248,13 +248,13 @@ class KTFieldset extends KTEntity {
248 'disabled' => false, 248 'disabled' => false,
249 )); 249 ));
250 } 250 }
251 - 251 +
252 function &getByName($sName) { 252 function &getByName($sName) {
253 return KTEntityUtil::getByDict('KTFieldset', array( 253 return KTEntityUtil::getByDict('KTFieldset', array(
254 'name' => $sName, 254 'name' => $sName,
255 'disabled' => false, 255 'disabled' => false,
256 )); 256 ));
257 - } 257 + }
258 } 258 }
259 259
260 ?> 260 ?>
lib/workflow/workflow.inc.php
@@ -9,32 +9,32 @@ @@ -9,32 +9,32 @@
9 * KnowledgeTree Open Source Edition 9 * KnowledgeTree Open Source Edition
10 * Document Management Made Simple 10 * Document Management Made Simple
11 * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited 11 * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
12 - * 12 + *
13 * This program is free software; you can redistribute it and/or modify it under 13 * This program is free software; you can redistribute it and/or modify it under
14 * the terms of the GNU General Public License version 3 as published by the 14 * the terms of the GNU General Public License version 3 as published by the
15 * Free Software Foundation. 15 * Free Software Foundation.
16 - * 16 + *
17 * This program is distributed in the hope that it will be useful, but WITHOUT 17 * This program is distributed in the hope that it will be useful, but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 19 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
20 * details. 20 * details.
21 - * 21 + *
22 * You should have received a copy of the GNU General Public License 22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <http://www.gnu.org/licenses/>. 23 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 - * 24 + *
25 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, 25 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
26 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. 26 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
27 - * 27 + *
28 * The interactive user interfaces in modified source and object code versions 28 * The interactive user interfaces in modified source and object code versions
29 * of this program must display Appropriate Legal Notices, as required under 29 * of this program must display Appropriate Legal Notices, as required under
30 * Section 5 of the GNU General Public License version 3. 30 * Section 5 of the GNU General Public License version 3.
31 - * 31 + *
32 * In accordance with Section 7(b) of the GNU General Public License version 3, 32 * In accordance with Section 7(b) of the GNU General Public License version 3,
33 * these Appropriate Legal Notices must retain the display of the "Powered by 33 * these Appropriate Legal Notices must retain the display of the "Powered by
34 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the 34 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
35 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 35 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
36 - * must display the words "Powered by KnowledgeTree" and retain the original  
37 - * copyright notice. 36 + * must display the words "Powered by KnowledgeTree" and retain the original
  37 + * copyright notice.
38 * Contributor( s): ______________________________________ 38 * Contributor( s): ______________________________________
39 */ 39 */
40 40
@@ -59,13 +59,13 @@ class KTWorkflow extends KTEntity { @@ -59,13 +59,13 @@ class KTWorkflow extends KTEntity {
59 var $_bUsePearError = true; 59 var $_bUsePearError = true;
60 60
61 function getID() { return $this->iId; } 61 function getID() { return $this->iId; }
62 - function getName() { return sanitizeForSQLtoHTML($this->sName); }  
63 - function getHumanName() { return sanitizeForSQLtoHTML($this->sHumanName); } 62 + function getName() { return ($this->sName); }
  63 + function getHumanName() { return ($this->sHumanName); }
64 function getStartStateId() { return $this->iStartStateId; } 64 function getStartStateId() { return $this->iStartStateId; }
65 function getIsEnabled() { return ($this->bEnabled == true); } 65 function getIsEnabled() { return ($this->bEnabled == true); }
66 function setID($iId) { $this->iId = $iId; } 66 function setID($iId) { $this->iId = $iId; }
67 - function setName($sName) { $this->sName = sanitizeForSQL($sName); }  
68 - function setHumanName($sHumanName) { $this->sHumanName = sanitizeForSQL($sHumanName); } 67 + function setName($sName) { $this->sName = ($sName); }
  68 + function setHumanName($sHumanName) { $this->sHumanName = ($sHumanName); }
69 function setStartStateId($iStartStateId) { $this->iStartStateId = $iStartStateId; } 69 function setStartStateId($iStartStateId) { $this->iStartStateId = $iStartStateId; }
70 function setIsEnabled($mValue) { $this->bEnabled = ($mValue == true); } 70 function setIsEnabled($mValue) { $this->bEnabled = ($mValue == true); }
71 71
@@ -98,7 +98,7 @@ class KTWorkflow extends KTEntity { @@ -98,7 +98,7 @@ class KTWorkflow extends KTEntity {
98 function &getByName($sName) { 98 function &getByName($sName) {
99 return KTEntityUtil::getBy('KTWorkflow', 'name', $sName); 99 return KTEntityUtil::getBy('KTWorkflow', 'name', $sName);
100 } 100 }
101 - 101 +
102 function getIsFunctional() { 102 function getIsFunctional() {
103 return (($this->getStartStateId() != false) && ($this->getIsEnabled())); 103 return (($this->getStartStateId() != false) && ($this->getIsEnabled()));
104 } 104 }
lib/workflow/workflowstate.inc.php
@@ -8,32 +8,32 @@ @@ -8,32 +8,32 @@
8 * KnowledgeTree Open Source Edition 8 * KnowledgeTree Open Source Edition
9 * Document Management Made Simple 9 * Document Management Made Simple
10 * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited 10 * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
11 - * 11 + *
12 * This program is free software; you can redistribute it and/or modify it under 12 * This program is free software; you can redistribute it and/or modify it under
13 * the terms of the GNU General Public License version 3 as published by the 13 * the terms of the GNU General Public License version 3 as published by the
14 * Free Software Foundation. 14 * Free Software Foundation.
15 - * 15 + *
16 * This program is distributed in the hope that it will be useful, but WITHOUT 16 * This program is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 * details. 19 * details.
20 - * 20 + *
21 * You should have received a copy of the GNU General Public License 21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>. 22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 - * 23 + *
24 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, 24 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
25 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. 25 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
26 - * 26 + *
27 * The interactive user interfaces in modified source and object code versions 27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under 28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU General Public License version 3. 29 * Section 5 of the GNU General Public License version 3.
30 - * 30 + *
31 * In accordance with Section 7(b) of the GNU General Public License version 3, 31 * In accordance with Section 7(b) of the GNU General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by 32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the 33 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
34 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 34 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
35 - * must display the words "Powered by KnowledgeTree" and retain the original  
36 - * copyright notice. 35 + * must display the words "Powered by KnowledgeTree" and retain the original
  36 + * copyright notice.
37 * Contributor( s): ______________________________________ 37 * Contributor( s): ______________________________________
38 */ 38 */
39 39
@@ -57,20 +57,20 @@ class KTWorkflowState extends KTEntity { @@ -57,20 +57,20 @@ class KTWorkflowState extends KTEntity {
57 var $_bUsePearError = true; 57 var $_bUsePearError = true;
58 58
59 function getId() { return $this->iId; } 59 function getId() { return $this->iId; }
60 - function getName() { return sanitizeForSQLtoHTML($this->sName); }  
61 - function getHumanName() { return sanitizeForSQLtoHTML($this->sHumanName); } 60 + function getName() { return ($this->sName); }
  61 + function getHumanName() { return ($this->sHumanName); }
62 function getWorkflowId() { return $this->iWorkflowId; } 62 function getWorkflowId() { return $this->iWorkflowId; }
63 function getInformDescriptorId() { return $this->iInformDescriptorId; } 63 function getInformDescriptorId() { return $this->iInformDescriptorId; }
64 function setId($iId) { $this->iId = $iId; } 64 function setId($iId) { $this->iId = $iId; }
65 - function setName($sName) { $this->sName = sanitizeForSQL($sName); }  
66 - function setHumanName($sHumanName) { $this->sHumanName = sanitizeForSQL($sHumanName); } 65 + function setName($sName) { $this->sName = ($sName); }
  66 + function setHumanName($sHumanName) { $this->sHumanName = ($sHumanName); }
67 function setWorkflowId($iWorkflowId) { $this->iWorkflowId = $iWorkflowId; } 67 function setWorkflowId($iWorkflowId) { $this->iWorkflowId = $iWorkflowId; }
68 function setInformDescriptorId($iInformDescriptorId) { $this->iInformDescriptorId = $iInformDescriptorId; } 68 function setInformDescriptorId($iInformDescriptorId) { $this->iInformDescriptorId = $iInformDescriptorId; }
69 69
70 function _table () { 70 function _table () {
71 return KTUtil::getTableName('workflow_states'); 71 return KTUtil::getTableName('workflow_states');
72 } 72 }
73 - 73 +
74 function _ktentityOptions() { 74 function _ktentityOptions() {
75 return array( 75 return array(
76 'orderby' => 'human_name', 76 'orderby' => 'human_name',
@@ -128,13 +128,13 @@ class KTWorkflowState extends KTEntity { @@ -128,13 +128,13 @@ class KTWorkflowState extends KTEntity {
128 'KTWorkflowState', array( 128 'KTWorkflowState', array(
129 'name' => $sName, 129 'name' => $sName,
130 'workflow_id' => $iWorkflowId 130 'workflow_id' => $iWorkflowId
131 - ) 131 + )
132 ); 132 );
133 // expect KTEntityNoObjects 133 // expect KTEntityNoObjects
134 if (PEAR::isError($res)) { 134 if (PEAR::isError($res)) {
135 return false; 135 return false;
136 } 136 }
137 - 137 +
138 return true; 138 return true;
139 } 139 }
140 140
lib/workflow/workflowtransition.inc.php
@@ -8,32 +8,32 @@ @@ -8,32 +8,32 @@
8 * KnowledgeTree Open Source Edition 8 * KnowledgeTree Open Source Edition
9 * Document Management Made Simple 9 * Document Management Made Simple
10 * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited 10 * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
11 - * 11 + *
12 * This program is free software; you can redistribute it and/or modify it under 12 * This program is free software; you can redistribute it and/or modify it under
13 * the terms of the GNU General Public License version 3 as published by the 13 * the terms of the GNU General Public License version 3 as published by the
14 * Free Software Foundation. 14 * Free Software Foundation.
15 - * 15 + *
16 * This program is distributed in the hope that it will be useful, but WITHOUT 16 * This program is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 * details. 19 * details.
20 - * 20 + *
21 * You should have received a copy of the GNU General Public License 21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>. 22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 - * 23 + *
24 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, 24 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
25 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. 25 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
26 - * 26 + *
27 * The interactive user interfaces in modified source and object code versions 27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under 28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU General Public License version 3. 29 * Section 5 of the GNU General Public License version 3.
30 - * 30 + *
31 * In accordance with Section 7(b) of the GNU General Public License version 3, 31 * In accordance with Section 7(b) of the GNU General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by 32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the 33 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
34 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 34 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
35 - * must display the words "Powered by KnowledgeTree" and retain the original  
36 - * copyright notice. 35 + * must display the words "Powered by KnowledgeTree" and retain the original
  36 + * copyright notice.
37 * Contributor( s): ______________________________________ 37 * Contributor( s): ______________________________________
38 */ 38 */
39 39
@@ -67,8 +67,8 @@ class KTWorkflowTransition extends KTEntity { @@ -67,8 +67,8 @@ class KTWorkflowTransition extends KTEntity {
67 var $_bUsePearError = true; 67 var $_bUsePearError = true;
68 68
69 function getId() { return $this->iId; } 69 function getId() { return $this->iId; }
70 - function getName() { return sanitizeForSQLtoHTML($this->sName); }  
71 - function getHumanName() { return sanitizeForSQLtoHTML($this->sHumanName); } 70 + function getName() { return ($this->sName); }
  71 + function getHumanName() { return ($this->sHumanName); }
72 function getWorkflowId() { return $this->iWorkflowId; } 72 function getWorkflowId() { return $this->iWorkflowId; }
73 function getTargetStateId() { return $this->iTargetStateId; } 73 function getTargetStateId() { return $this->iTargetStateId; }
74 function getGuardPermissionId() { return $this->iGuardPermissionId; } 74 function getGuardPermissionId() { return $this->iGuardPermissionId; }
@@ -77,8 +77,8 @@ class KTWorkflowTransition extends KTEntity { @@ -77,8 +77,8 @@ class KTWorkflowTransition extends KTEntity {
77 function getGuardConditionId() { return $this->iGuardConditionId; } 77 function getGuardConditionId() { return $this->iGuardConditionId; }
78 78
79 function setId($iId) { $this->iId = $iId; } 79 function setId($iId) { $this->iId = $iId; }
80 - function setName($sName) { $this->sName = sanitizeForSQL($sName); }  
81 - function setHumanName($sHumanName) { $this->sHumanName = sanitizeForSQL($sHumanName); } 80 + function setName($sName) { $this->sName = ($sName); }
  81 + function setHumanName($sHumanName) { $this->sHumanName = ($sHumanName); }
82 function setWorkflowId($iWorkflowId) { $this->iWorkflowId = $iWorkflowId; } 82 function setWorkflowId($iWorkflowId) { $this->iWorkflowId = $iWorkflowId; }
83 function setTargetStateId($iTargetStateId) { $this->iTargetStateId = $iTargetStateId; } 83 function setTargetStateId($iTargetStateId) { $this->iTargetStateId = $iTargetStateId; }
84 function setGuardPermissionId($iGuardPermissionId) { $this->iGuardPermissionId = $iGuardPermissionId; } 84 function setGuardPermissionId($iGuardPermissionId) { $this->iGuardPermissionId = $iGuardPermissionId; }
@@ -89,7 +89,7 @@ class KTWorkflowTransition extends KTEntity { @@ -89,7 +89,7 @@ class KTWorkflowTransition extends KTEntity {
89 function _table () { 89 function _table () {
90 return KTUtil::getTableName('workflow_transitions'); 90 return KTUtil::getTableName('workflow_transitions');
91 } 91 }
92 - 92 +
93 // STATIC 93 // STATIC
94 function _ktentityOptions() { 94 function _ktentityOptions() {
95 return array( 95 return array(
@@ -146,7 +146,7 @@ class KTWorkflowTransition extends KTEntity { @@ -146,7 +146,7 @@ class KTWorkflowTransition extends KTEntity {
146 $oWorkflowState =& KTWorkflowState::get($this->getTargetStateId()); 146 $oWorkflowState =& KTWorkflowState::get($this->getTargetStateId());
147 return sprintf(_kt("%s (to state %s)"), $this->getName(), $oWorkflowState->getName()); 147 return sprintf(_kt("%s (to state %s)"), $this->getName(), $oWorkflowState->getName());
148 } 148 }
149 - 149 +
150 // STATIC 150 // STATIC
151 function nameExists($sName, $oWorkflow) { 151 function nameExists($sName, $oWorkflow) {
152 $iWorkflowId = KTUtil::getId($oWorkflow); 152 $iWorkflowId = KTUtil::getId($oWorkflow);
@@ -154,16 +154,16 @@ class KTWorkflowTransition extends KTEntity { @@ -154,16 +154,16 @@ class KTWorkflowTransition extends KTEntity {
154 'KTWorkflowTransition', array( 154 'KTWorkflowTransition', array(
155 'name' => $sName, 155 'name' => $sName,
156 'workflow_id' => $iWorkflowId 156 'workflow_id' => $iWorkflowId
157 - ) 157 + )
158 ); 158 );
159 // expect KTEntityNoObjects 159 // expect KTEntityNoObjects
160 if (PEAR::isError($res)) { 160 if (PEAR::isError($res)) {
161 return false; 161 return false;
162 } 162 }
163 - 163 +
164 return true; 164 return true;
165 } 165 }
166 - 166 +
167 } 167 }
168 168
169 ?> 169 ?>
plugins/housekeeper/DiskUsageDashlet.inc.php
@@ -61,13 +61,23 @@ class DiskUsageDashlet extends KTBaseDashlet @@ -61,13 +61,23 @@ class DiskUsageDashlet extends KTBaseDashlet
61 $this->warningPercent = $config->get('DiskUsage/warningThreshold', 15); 61 $this->warningPercent = $config->get('DiskUsage/warningThreshold', 15);
62 $this->urgentPercent = $config->get('DiskUsage/urgentThreshold', 5); 62 $this->urgentPercent = $config->get('DiskUsage/urgentThreshold', 5);
63 63
64 - $this->getUsage(); 64 + $got_usage = $this->getUsage();
  65 +
  66 + if ($got_usage == false)
  67 + {
  68 + return false;
  69 + }
65 70
66 return Permission::userIsSystemAdministrator(); 71 return Permission::userIsSystemAdministrator();
67 } 72 }
68 73
69 function getUsage($refresh=false) 74 function getUsage($refresh=false)
70 { 75 {
  76 + if (isset($_SESSION['DiskUsage']['problem']))
  77 + {
  78 + return false;
  79 + }
  80 +
71 $check = true; 81 $check = true;
72 // check if we have a cached result 82 // check if we have a cached result
73 if (isset($_SESSION['DiskUsage'])) 83 if (isset($_SESSION['DiskUsage']))
@@ -96,6 +106,13 @@ class DiskUsageDashlet extends KTBaseDashlet @@ -96,6 +106,13 @@ class DiskUsageDashlet extends KTBaseDashlet
96 $result = shell_exec($cmd." 2>&1"); 106 $result = shell_exec($cmd." 2>&1");
97 } 107 }
98 108
  109 + if (strpos($result, 'cannot read table of mounted file systems') !== false)
  110 + {
  111 + $_SESSION['DiskUsage']['problem'] = true;
  112 + return false;
  113 + }
  114 +
  115 +
99 $result = explode("\n", $result); 116 $result = explode("\n", $result);
100 117
101 unset($result[0]); // gets rid of headings 118 unset($result[0]); // gets rid of headings
@@ -135,6 +152,8 @@ class DiskUsageDashlet extends KTBaseDashlet @@ -135,6 +152,8 @@ class DiskUsageDashlet extends KTBaseDashlet
135 $_SESSION['DiskUsage']['time'] = time(); 152 $_SESSION['DiskUsage']['time'] = time();
136 $_SESSION['DiskUsage']['usage'] = $this->usage; 153 $_SESSION['DiskUsage']['usage'] = $this->usage;
137 } 154 }
  155 +
  156 + return true;
138 } 157 }
139 158
140 function render() 159 function render()
plugins/ktcore/KTBulkActions.php
@@ -49,13 +49,13 @@ class KTBulkDeleteAction extends KTBulkAction { @@ -49,13 +49,13 @@ class KTBulkDeleteAction extends KTBulkAction {
49 function getDisplayName() { 49 function getDisplayName() {
50 return _kt('Delete'); 50 return _kt('Delete');
51 } 51 }
52 - 52 +
53 function check_entity($oEntity) { 53 function check_entity($oEntity) {
54 if(is_a($oEntity, 'Document')) { 54 if(is_a($oEntity, 'Document')) {
55 if($oEntity->getImmutable()) 55 if($oEntity->getImmutable())
56 { 56 {
57 return PEAR::raiseError(_kt('Document cannot be deleted as it is immutable')); 57 return PEAR::raiseError(_kt('Document cannot be deleted as it is immutable'));
58 - } 58 + }
59 } 59 }
60 return parent::check_entity($oEntity); 60 return parent::check_entity($oEntity);
61 } 61 }
@@ -894,11 +894,23 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction { @@ -894,11 +894,23 @@ class KTBrowseBulkCheckoutAction extends KTBulkAction {
894 $sReason = $this->sReason; 894 $sReason = $this->sReason;
895 895
896 if(is_a($oEntity, 'Document')) { 896 if(is_a($oEntity, 'Document')) {
897 - $res = KTDocumentUtil::checkout($oEntity, $sReason, $this->oUser);  
898 897
899 - if(PEAR::isError($res)) {  
900 - return PEAR::raiseError($oEntity->getName().': '.$res->getMessage()); 898 + if($oEntity->getIsCheckedOut()){
  899 + $checkedOutUser = $oEntity->getCheckedOutUserID();
  900 + $sUserId = $_SESSION['userID'];
  901 +
  902 + if($checkedOutUser != $sUserId){
  903 + $oCheckedOutUser = User::get($checkedOutUser);
  904 + return PEAR::raiseError($oEntity->getName().': '._kt('Document has already been checked out by ').$oCheckedOutUser->getName());
  905 + }
  906 + }else{
  907 + $res = KTDocumentUtil::checkout($oEntity, $sReason, $this->oUser);
  908 +
  909 + if(PEAR::isError($res)) {
  910 + return PEAR::raiseError($oEntity->getName().': '.$res->getMessage());
  911 + }
901 } 912 }
  913 +
902 if($this->bDownload){ 914 if($this->bDownload){
903 if ($this->bNoisy) { 915 if ($this->bNoisy) {
904 $oDocumentTransaction = new DocumentTransaction($oEntity, "Document part of bulk checkout", 'ktstandard.transactions.check_out', array()); 916 $oDocumentTransaction = new DocumentTransaction($oEntity, "Document part of bulk checkout", 'ktstandard.transactions.check_out', array());
plugins/ktcore/admin/expungeList.php
@@ -39,8 +39,9 @@ require_once(KT_LIB_DIR . &#39;/browse/browseutil.inc.php&#39;); @@ -39,8 +39,9 @@ require_once(KT_LIB_DIR . &#39;/browse/browseutil.inc.php&#39;);
39 39
40 require_once(KT_LIB_DIR . '/documentmanagement/Document.inc'); 40 require_once(KT_LIB_DIR . '/documentmanagement/Document.inc');
41 require_once(KT_LIB_DIR . '/documentmanagement/DocumentTransaction.inc'); 41 require_once(KT_LIB_DIR . '/documentmanagement/DocumentTransaction.inc');
42 -  
43 -$aDocuments =& Document::getList("status_id=" . DELETED); 42 +
  43 +$sWhere = "status_id=" . DELETED;
  44 +$aDocuments =& Document::getList($sWhere);
44 45
45 $pageNum = $_REQUEST['page']; 46 $pageNum = $_REQUEST['page'];
46 47
@@ -50,6 +51,11 @@ if(fmod($items, 10) &gt; 0){ @@ -50,6 +51,11 @@ if(fmod($items, 10) &gt; 0){
50 }else{ 51 }else{
51 $pages = ($items/10); 52 $pages = ($items/10);
52 } 53 }
  54 +
  55 +for($i=1; $i<=$pages; $i++){
  56 + $aPages[] = $i;
  57 +}
  58 +
53 if($pageNum == 1){ 59 if($pageNum == 1){
54 $listStart = 0; 60 $listStart = 0;
55 $listEnd = 9; 61 $listEnd = 9;
@@ -60,13 +66,53 @@ if($pageNum == 1){ @@ -60,13 +66,53 @@ if($pageNum == 1){
60 $listStart = (10*($pageNum-1)); 66 $listStart = (10*($pageNum-1));
61 $listEnd = $listStart+9; 67 $listEnd = $listStart+9;
62 } 68 }
  69 +
  70 +
  71 +
  72 +$output = "<table class=\"kt_collection\">
  73 + <thead>
  74 + <tr>
  75 + <th style=\"width:2em\"><input type=\"checkbox\" onclick=\"toggleSelectFor(this, 'selected_docs')\" title=\"toggle all\"/></th>
  76 + <th>"._kt('Document Name').'</th>
  77 + <th>'._kt('Last Modification').'</th>
  78 + <th>'._kt('Deletion Comment').'</th>
  79 + </tr>
  80 + </thead>
  81 + <tbody>';
  82 +
  83 +
63 for($i = $listStart; $i <= $listEnd; $i++){ 84 for($i = $listStart; $i <= $listEnd; $i++){
64 - $output .= "<tr>  
65 - <td><input type='checkbox' name='selected_docs[]' value='".$aDocuments[$i]->getId()."'/></td> 85 + $output .= "
  86 + <tr>
  87 + <td><input type=\"checkbox\" name=\"selected_docs[]\" value=\"".$aDocuments[$i]->getId()."\"/></td>
66 <td>".$aDocuments[$i]->getName()."</td> 88 <td>".$aDocuments[$i]->getName()."</td>
67 <td>".$aDocuments[$i]->getLastModifiedDate()."</td> 89 <td>".$aDocuments[$i]->getLastModifiedDate()."</td>
68 <td>".$aDocuments[$i]->getLastDeletionComment()."</td> 90 <td>".$aDocuments[$i]->getLastDeletionComment()."</td>
69 </tr>"; 91 </tr>";
  92 +
70 } 93 }
  94 +
  95 +
  96 +$output .= '<tfoot>
  97 + <tr>
  98 + <td colspan="4">
  99 + <span style="float: left">'.$items.' '._kt('items, 10 per page').'</span>
  100 + </td>
  101 + </tr>
  102 + <tr>
  103 + <td colspan="4">
  104 + <div align="center">';
  105 +
  106 + foreach($aPages as $page){
  107 + $output .= '<a href="#" onclick="buildList(this.innerHTML)">'.$page.'</a>&nbsp;';
  108 + }
  109 +
  110 +$output .= '</div>
  111 + </td>
  112 + </tr>
  113 + </tfoot>
  114 + </table>
  115 + </tbody></table>';
  116 +
71 echo $output; 117 echo $output;
72 ?> 118 ?>
plugins/ktcore/folder/Permissions.php
@@ -453,11 +453,29 @@ class KTFolderPermissionsAction extends KTFolderAction { @@ -453,11 +453,29 @@ class KTFolderPermissionsAction extends KTFolderAction {
453 if (!KTBrowseUtil::inAdminMode($this->oUser, $this->oFolder)) { 453 if (!KTBrowseUtil::inAdminMode($this->oUser, $this->oFolder)) {
454 $this->oValidator->userHasPermissionOnItem($this->oUser, $this->_sEditShowPermission, $this->oFolder, $aOptions); 454 $this->oValidator->userHasPermissionOnItem($this->oUser, $this->_sEditShowPermission, $this->oFolder, $aOptions);
455 } 455 }
  456 +
  457 + $aFoo = $_REQUEST['foo'];
  458 + $aPermissions = KTPermission::getList();
  459 +
  460 + // Check which groups have permission to manage security
  461 + $aNewGroups = $aFoo[4]['group'];
  462 + $aNewRoles = (isset($aFoo[4]['role']) ? $aFoo[4]['role'] : array());
  463 +
  464 + // Ensure the user is not removing his/her own permission to update the folder permissions (manage security)
  465 + if(!in_array(-3, $aNewRoles)){
  466 + $iUserId = $this->oUser->getId();
  467 + if(!GroupUtil::checkUserInGroups($iUserId, $aNewGroups)){
  468 + // If user no longer has permission, return an error.
  469 + $this->addErrorMessage(_kt('The selected permissions cannot be updated. You will no longer have permission to manage security on this folder.'));
  470 + $this->redirectTo('edit', 'fFolderId=' . $this->oFolder->getId());
  471 + exit(0);
  472 + }
  473 + }
  474 +
  475 +
456 require_once(KT_LIB_DIR . '/documentmanagement/observers.inc.php'); 476 require_once(KT_LIB_DIR . '/documentmanagement/observers.inc.php');
457 $oPO = KTPermissionObject::get($this->oFolder->getPermissionObjectId()); 477 $oPO = KTPermissionObject::get($this->oFolder->getPermissionObjectId());
458 - $aFoo = $_REQUEST['foo'];  
459 478
460 - $aPermissions = KTPermission::getList();  
461 foreach ($aPermissions as $oPermission) { 479 foreach ($aPermissions as $oPermission) {
462 $iPermId = $oPermission->getId(); 480 $iPermId = $oPermission->getId();
463 481
@@ -471,11 +489,11 @@ class KTFolderPermissionsAction extends KTFolderAction { @@ -471,11 +489,11 @@ class KTFolderPermissionsAction extends KTFolderAction {
471 'transactionNS' => 'ktcore.transactions.permissions_change', 489 'transactionNS' => 'ktcore.transactions.permissions_change',
472 'userid' => $_SESSION['userID'], 490 'userid' => $_SESSION['userID'],
473 'ip' => Session::getClientIP(), 491 'ip' => Session::getClientIP(),
474 - )); 492 + ));
475 $aOptions = array( 493 $aOptions = array(
476 'defaultmessage' => _kt('Error updating permissions'), 494 'defaultmessage' => _kt('Error updating permissions'),
477 'redirect_to' => array('edit', sprintf('fFolderId=%d', $this->oFolder->getId())), 495 'redirect_to' => array('edit', sprintf('fFolderId=%d', $this->oFolder->getId())),
478 - ); 496 + );
479 $this->oValidator->notErrorFalse($oTransaction, $aOptions); 497 $this->oValidator->notErrorFalse($oTransaction, $aOptions);
480 498
481 $po =& new JavascriptObserver($this); 499 $po =& new JavascriptObserver($this);
plugins/ktstandard/ImmutableActionPlugin.php
@@ -65,9 +65,17 @@ class KTDocumentImmutableAction extends KTDocumentAction { @@ -65,9 +65,17 @@ class KTDocumentImmutableAction extends KTDocumentAction {
65 } 65 }
66 66
67 function do_main() { 67 function do_main() {
68 - $this->oDocument->setImmutable(true);  
69 - $this->oDocument->update();  
70 - controllerRedirect('viewDocument', 'fDocumentId=' . $this->oDocument->getId()); 68 + if(!$this->oDocument->getIsCheckedOut())
  69 + {
  70 + $this->oDocument->setImmutable(true);
  71 + $this->oDocument->update();
  72 + controllerRedirect('viewDocument', 'fDocumentId=' . $this->oDocument->getId());
  73 + }
  74 + else
  75 + {
  76 + $this->addErrorMessage(_kt('Document is checked out and cannot be made immutable'));
  77 + controllerRedirect('viewDocument', 'fDocumentId=' . $this->oDocument->getId());
  78 + }
71 } 79 }
72 } 80 }
73 81
resources/js/expungeList.js
@@ -16,7 +16,7 @@ function buildList(value){ @@ -16,7 +16,7 @@ function buildList(value){
16 16
17 function stateChanged(){ 17 function stateChanged(){
18 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 18 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
19 - document.getElementById("output").innerHTML=xmlHttp.responseText; 19 + document.getElementById("tableoutput").innerHTML=xmlHttp.responseText;
20 } 20 }
21 } 21 }
22 22
search2/search/fieldRegistry.inc.php
@@ -259,8 +259,8 @@ class ExprFieldRegistry @@ -259,8 +259,8 @@ class ExprFieldRegistry
259 259
260 foreach($result as $record) 260 foreach($result as $record)
261 { 261 {
262 - $fieldset = $record['fieldset'];  
263 - $field = $record['field']; 262 + $fieldset = addslashes($record['fieldset']);
  263 + $field = addslashes($record['field']);
264 $fieldsetid = $record['fsid']; 264 $fieldsetid = $record['fsid'];
265 $fieldid = $record['fid']; 265 $fieldid = $record['fid'];
266 $classname = "MetadataField$fieldid"; 266 $classname = "MetadataField$fieldid";
search2/search/search.inc.php
@@ -96,7 +96,7 @@ class SearchHelper @@ -96,7 +96,7 @@ class SearchHelper
96 { 96 {
97 if ($dt++ > 0) $documenttypes_str .= ','; 97 if ($dt++ > 0) $documenttypes_str .= ',';
98 $id=$user['id']; 98 $id=$user['id'];
99 - $name=$user['name']; 99 + $name=(addslashes($user['name']));
100 100
101 $documenttypes_str .= "\n\t{id: \"$id\", name: \"$name\"}"; 101 $documenttypes_str .= "\n\t{id: \"$id\", name: \"$name\"}";
102 } 102 }
@@ -139,7 +139,7 @@ class SearchHelper @@ -139,7 +139,7 @@ class SearchHelper
139 { 139 {
140 if ($uo++ > 0) $users_str .= ','; 140 if ($uo++ > 0) $users_str .= ',';
141 $id=$user['id']; 141 $id=$user['id'];
142 - $name=$user['name']; 142 + $name=(addslashes($user['name']));
143 143
144 $users_str .= "\n\t{id: \"$id\", name: \"$name\"}"; 144 $users_str .= "\n\t{id: \"$id\", name: \"$name\"}";
145 } 145 }
@@ -159,8 +159,8 @@ class SearchHelper @@ -159,8 +159,8 @@ class SearchHelper
159 foreach($fields as $field) 159 foreach($fields as $field)
160 { 160 {
161 if ($fo++ > 0) $fields_str .= ','; 161 if ($fo++ > 0) $fields_str .= ',';
162 - $alias = $field['alias'];  
163 - $display = $field['display']; 162 + $alias = (addslashes($field['alias']));
  163 + $display = (addslashes($field['display']));
164 $type = $field['type']; 164 $type = $field['type'];
165 $fields_str .= "\n\t{alias: \"$alias\", name: \"$display\", type:\"$type\"}"; 165 $fields_str .= "\n\t{alias: \"$alias\", name: \"$display\", type:\"$type\"}";
166 } 166 }
@@ -182,7 +182,7 @@ class SearchHelper @@ -182,7 +182,7 @@ class SearchHelper
182 { 182 {
183 if ($wo++ > 0) $workflow_str .= ','; 183 if ($wo++ > 0) $workflow_str .= ',';
184 $wid = $workflow['id']; 184 $wid = $workflow['id'];
185 - $name = $workflow['name']; 185 + $name = (addslashes($workflow['name']));
186 186
187 $workflow_str .= "\n\t{id:\"$wid\", name: \"$name\", states: [ "; 187 $workflow_str .= "\n\t{id:\"$wid\", name: \"$name\", states: [ ";
188 188
@@ -194,7 +194,7 @@ class SearchHelper @@ -194,7 +194,7 @@ class SearchHelper
194 { 194 {
195 if ($so++>0) $workflow_str .= ','; 195 if ($so++>0) $workflow_str .= ',';
196 $sid = $state['id']; 196 $sid = $state['id'];
197 - $name=$state['name']; 197 + $name=(addslashes($state['name']));
198 $result['workflows'][$wid]['states'][$sid] = $state; 198 $result['workflows'][$wid]['states'][$sid] = $state;
199 $workflow_str .= "\n\t\t{id:\"$wid\", name: \"$name\"}"; 199 $workflow_str .= "\n\t\t{id:\"$wid\", name: \"$name\"}";
200 } 200 }
@@ -217,8 +217,8 @@ class SearchHelper @@ -217,8 +217,8 @@ class SearchHelper
217 foreach($fieldsets as $fieldset) 217 foreach($fieldsets as $fieldset)
218 { 218 {
219 $fsid=$fieldset['id']; 219 $fsid=$fieldset['id'];
220 - $name = $fieldset['name'];  
221 - $desc = $fieldset['description']; 220 + $name = (addslashes($fieldset['name']));
  221 + $desc = (addslashes($fieldset['description']));
222 if ($fso++>0) $fieldset_str .= ','; 222 if ($fso++>0) $fieldset_str .= ',';
223 $fieldset_str .= "\n\t{id:\"$fsid\",name:\"$name\",description:\"$desc\", fields: ["; 223 $fieldset_str .= "\n\t{id:\"$fsid\",name:\"$name\",description:\"$desc\", fields: [";
224 224
@@ -231,8 +231,8 @@ class SearchHelper @@ -231,8 +231,8 @@ class SearchHelper
231 { 231 {
232 if ($fo++ >0) $fieldset_str .= ','; 232 if ($fo++ >0) $fieldset_str .= ',';
233 $fid = $field['id']; 233 $fid = $field['id'];
234 - $name= $field['name'];  
235 - $desc = $field['description']; 234 + $name= (addslashes($field['name']));
  235 + $desc = (addslashes($field['description']));
236 $datatype=$field['datatype']; 236 $datatype=$field['datatype'];
237 $control=$field['control']; 237 $control=$field['control'];
238 $fieldset_str .= "\n\t\t{id:\"$fid\", name:\"$name\", description:\"$desc\", datatype:\"$datatype\", control:\"$control\", options: ["; 238 $fieldset_str .= "\n\t\t{id:\"$fid\", name:\"$name\", description:\"$desc\", datatype:\"$datatype\", control:\"$control\", options: [";
@@ -246,7 +246,7 @@ class SearchHelper @@ -246,7 +246,7 @@ class SearchHelper
246 { 246 {
247 if ($oo++ > 0) $fieldset_str .= ','; 247 if ($oo++ > 0) $fieldset_str .= ',';
248 $oid = $option['id']; 248 $oid = $option['id'];
249 - $name= $option['name']; 249 + $name= (addslashes($option['name']));
250 $fieldset_str .= "\n\t\t\t{id: \"$oid\", name: \"$name\"}"; 250 $fieldset_str .= "\n\t\t\t{id: \"$oid\", name: \"$name\"}";
251 } 251 }
252 $fieldset_str .= ']}'; 252 $fieldset_str .= ']}';
templates/ktcore/document/admin/deletedlist.smarty
@@ -17,6 +17,7 @@ can &lt;strong&gt;restore&lt;/strong&gt; them as necessary.{/i18n}&lt;/p&gt; @@ -17,6 +17,7 @@ can &lt;strong&gt;restore&lt;/strong&gt; them as necessary.{/i18n}&lt;/p&gt;
17 {foreach item=oFDoc from=$fullList} 17 {foreach item=oFDoc from=$fullList}
18 <input type="hidden" name="docIds[]" value="{$oFDoc->getId()}"> 18 <input type="hidden" name="docIds[]" value="{$oFDoc->getId()}">
19 {/foreach} 19 {/foreach}
  20 +<div id="tableoutput">
20 <table class="kt_collection"> 21 <table class="kt_collection">
21 <thead> 22 <thead>
22 <tr> 23 <tr>
@@ -55,6 +56,7 @@ can &lt;strong&gt;restore&lt;/strong&gt; them as necessary.{/i18n}&lt;/p&gt; @@ -55,6 +56,7 @@ can &lt;strong&gt;restore&lt;/strong&gt; them as necessary.{/i18n}&lt;/p&gt;
55 </tr> 56 </tr>
56 </tfoot> 57 </tfoot>
57 </table> 58 </table>
  59 +</div>
58 <div class="form_actions"> 60 <div class="form_actions">
59 <input type="submit" name="submit[expunge]" value="{i18n}Expunge{/i18n}" /> 61 <input type="submit" name="submit[expunge]" value="{i18n}Expunge{/i18n}" />
60 <input type="submit" name="submit[restore]" value="{i18n}Restore{/i18n}" /> 62 <input type="submit" name="submit[restore]" value="{i18n}Restore{/i18n}" />